gpt4 book ai didi

android - 如何在我的 Android React Native 项目中安装 Firebase AppCheck?

转载 作者:行者123 更新时间:2023-12-04 23:50:32 25 4
gpt4 key购买 nike

我在 Firebase 中使用 Appcheck 保护了我的项目,我的 firebase 项目中有两个应用程序,其中一个是 网络应用 ( https://host-bloodhelper.web.app/ ),另一个是 Android 应用(React Native 应用) .我正在使用我在项目中使用 Yarn 安装的 react-native-firebase 库。我只使用firebase实时数据库API,当我有appCheck Unenforced(关闭)时它工作正常。我找不到任何关于如何在 Android 上的 React native 中安装 appCheck 的文档,甚至在官方 website 上也找不到。 .
我的 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 应用检查:
Firebase AppCheck Screenshot
Recaptcha 在我的网站上运行良好,但 SafetyNet 在 Android 上的 React Native 中无法运行。
谁能向我解释如何在 Android 上的 React Native 中安装 appCheck。任何帮助表示赞赏。

最佳答案

不确定这是否会有所帮助,但我的基于 react 的网络应用程序遇到了同样的问题,最终遇到了这个页面,该页面显示了如何在 JS 中安装和初始化应用程序检查。我从未使用过 React-Native,但它应该很容易转换此页面上的 JS 示例 https://firebase.google.com/docs/app-check/web/recaptcha-provider

关于android - 如何在我的 Android React Native 项目中安装 Firebase AppCheck?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68831267/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com