firebase登录验证_如何使用Firebase通过三步向身份验证本机添加身份验证

firebase登录验证

Authentication allows us to secure our apps, or limit access for non-user members. Authentication can also be used, for example, to limit access to a paid service or specific service.

身份验证使我们能够保护我们的应用程序安全,或限制非用户成员的访问权限。 身份验证也可以用于例如限制对付费服务或特定服务的访问。

That's just one example of how authentication can be in your app. Today we will add authentication to a React Native app using Firebase.

那只是在您的应用程序中如何进行身份验证的一个示例。 今天,我们将使用Firebase将身份验证添加到React Native应用程序。

1安装react-native-firebase (1 Installing react-native-firebase)

The first thing we do is install and initialize Firebase inside our app. In React Native we need to use a Firebase Container for React Native. We are going to use react-native-firebase.

我们要做的第一件事是在应用程序内部安装并初始化Firebase。 在React Native中,我们需要为Fire Native使用Firebase容器。 我们将使用react-native-firebase

If you are about to start a new React Native app from scratch and you would like to use Firebase, you are lucky - you can install react-native-firebase pre-integrated using the React Native CLI.

如果您将要从头开始一个新的React Native应用程序,并且想使用Firebase,那么您很幸运-您可以安装使用React Native CLI预集成的react-native-firebase。

//
npx @react-native-community/cli init --template=@react-native-firebase/template authenticationFirebase
//** source: https://invertase.io/oss/react-native-firebase/quick-start/new-project

Then just install the pod for iOS by running the following command inside the root directory of your app.

然后,只需在应用程序的根目录中运行以下命令,即可为iOS安装pod。

cd ios && pod install

If you are having issues installing a new project with Firebase please refer to react-native-firebase docs

如果您在使用Firebase安装新项目时遇到问题,请参阅react-native-firebase文档

将react-native-firebase添加到现有项目 (Adding react-native-firebase to an existing project)

Install the react-native-firebase package using yarn or npm

使用yarn或npm安装react-native-firebase软件包

yarn add @react-native-firebase/app

or:

要么:

npm install @react-native-firebase/app

Then install pods for iOS.

然后安装iOS的Pod。

shell cd ios && pod install

shell cd ios && pod install

运行应用 (Running the app)

For iOS, there are two ways to do it: I personally use Xcode, as it gives me a clear idea if something went wrong and the build failed.

Xcode

对于iOS,有两种方法可以实现:我个人使用Xcode,因为它可以使我清楚地知道出了什么问题并且构建失败。

Always make sure the package is running - hit yarn start to start the app.

始终确保程序包正在运行- yarn startyarn start以启动应用程序。

The second way to run the app on iOS is running the react-native run-ios command - and that's it.

在iOS上运行应用程序的第二种方法是运行re

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值