我在 Firebase 中使用 Appcheck 保护了我的项目,我的 firebase 项目中有两个应用程序,其中一个是Web 应用程序(https://host-bloodhelper.web.app/),另一个是Android 应用程序(React本机应用程序)。我正在使用我在项目中使用 Yarn 安装的 react-native-firebase 库。我只使用firebase实时数据库API,当我有appCheck Unenforced(关闭)时它工作正常。我找不到任何关于如何在 Android 上的 React native 中安装 appCheck 的文档,甚至在官方网站上也找不到。
我的 index.js 文件:
/**
* @format
*/
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
import firebase from '@react-native-firebase/app'
AppRegistry.registerComponent(appName, () => App);
应用程序.js:
// App.js is in functional component because of React navigation router.
// Every class component is wrapped in a functional component.
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import Login from './screens/login'
import Register from './screens/register'
import Registerb from './screens/registerb'
import Home from './screens/home'
import Profile from './screens/profile'
import Userprofile from './screens/userprofile'
import Deleteacc from './screens/deleteacc'
import Addbloodtype from './screens/addbloodtype'
import Privacy from './screens/privacy'
const Stack = createStackNavigator();
export default function App() {
return(
<NavigationContainer>
<Stack.Navigator
screenOptions={{
headerShown: false
}}
>
<Stack.Screen name="Register" component={Register} />
<Stack.Screen name="Registerb" component={Registerb} />
<Stack.Screen name="Login" component={Login} />
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Profile" component={Profile} />
<Stack.Screen name="Userprofile" component={Userprofile} />
<Stack.Screen name="Deleteacc" component={Deleteacc} />
<Stack.Screen name="Addbloodtype" component={Addbloodtype} />
</Stack.Navigator>
</NavigationContainer>
)
}
包.json:
{
"name": "BloodHelper",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.10",
"@react-native-firebase/analytics": "^12.6.0",
"@react-native-firebase/app": "^12.6.0",
"@react-native-firebase/database": "^12.6.0",
"@react-native-picker/picker": "^1.9.10",
"@react-navigation/native": "^5.9.0",
"@react-navigation/stack": "^5.13.0",
"firebase": "^8.2.3",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-elements": "^3.3.2",
"react-native-gesture-handler": "^1.9.0",
"react-native-loading-spinner-overlay": "^2.0.0",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.16.1",
"react-native-startapp-ads-module": "^0.0.10",
"react-native-vector-icons": "^8.1.0",
"react-native-webview": "^11.6.5",
"react-navigation": "^4.4.3",
"react-navigation-stack": "react-navigation/stack",
"rm": "^0.1.8"
},
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.18.0",
"jest": "^26.6.3",
"jetifier": "^2.0.0",
"metro-react-native-babel-preset": "^0.64.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
Firebase AppCheck:
Firebase AppCheck 屏幕截图
Recaptcha 在我的网站上运行良好,但 SafetyNet 在 Android 上的 React Native 中无法运行。
谁能向我解释如何在 Android 上的 React Native 中安装 appCheck。任何帮助表示赞赏。