Using Firebase Phone number Auth with react-native

后端 未结 4 1610
时光取名叫无心
时光取名叫无心 2020-12-16 17:59

With the newly released Firebase Phone number Auth, I was wondering if it is possible to use it using the firebase JS SDK within react native. If so how?

4条回答
  •  执念已碎
    2020-12-16 18:39

    For better user experience refer to this repo https://github.com/boudlal/react-native-firebase-phone-auth and i would suggest making some changes so that the user doesn't have to complete any challenges or click i am not a robot

    1. In Captcha.html file change the size to invisible so that token is generated in the background
        var captcha = new firebase.auth.RecaptchaVerifier("captcha", {
              size: "normal",
              callback: function (token) {
                callback(token);
              },
              "expired-callback": function () {
                callback("");
              },
            });
    
    
    1. The Captcha.html will be needed to be deployed to a server and is called via url in react-native-webview
    2. Style and remove unwanted text also make webview transparent by simply

    style={{backgroundColor:'transparent'}}

    1. Copy firebase config corresponding to your firebase project in the project and Captcha.html

提交回复
热议问题