Coder Social home page Coder Social logo

phone-firebase-auth's Introduction

react-native-firebase-phone-auth

This is an example of firebase phone auth in react native application. i searched in google lot of areas then i found this example this is working good.This method not fully belongs to me..i will post a video also here....

Getting Started

1.We have special static "Captcha" web page, hosted on domain, that authorized on our Firebase project. It simply shows firebase.auth.RecaptchaVerifier. User resolves captcha and it gives token string from response of callback.

2.On application login screen we show WebBrowser with "Captcha" page and listening url change event by Linking methods. On new url, we extract token string from it.

3.Then we create fake firebase.auth.ApplicationVerifier object with token and pass it to firebase.auth().signInWithPhoneNumber (with phone number). SMS code will be sent.

I wrote tested simplest code below. You can directly "copy-paste" it. Just add firebase config (this config must be same for both) and set correct "Captcha" page url. Don't forget that phone must be entered in international format. In this code "Captcha" page hosted on firebase hosting, so it automatically initializing by including init.js and authorized by default.

Features

  • Expo TabNavigated Example
  • Full Authenticated
  • Authentication Handled AppNavigator
  • FirebasePhone Authentication Full

How its Works ?

  • First You need a "captcha.html" page which i uploaded ( Me Hosted in My Firebase )
  • We Take The Token From this html page and send to the app .
  • fake firebase auth will work with that given token
  • SMS code will send to Our Given Phone Number
Go to " ./authentication/Loginscreen " Edit captchaUrl with Your Hosted URL
Go to " App.js " Change Your Firebase Config
Here You Must Enter The Number is in international format eg: if indian Number then type " +91xxxxxxxxxx " .
How To Install ?
git clone https://github.com/thareekanvar/react-native-firebase-phone-auth.git
Example

Imgur Image

Here Uploading The App.js Content and The Html Page .

phone-firebase-auth's People

Contributors

rishigupta121 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.