0

I am integrating Firebase phone number auth in to my app which uses the ConnectyCube API for video calling. ConnectyCube specifically recommends doing this for integration with its service.

Once the user has signed in with their phone number the app should pass the access token it receives from Firebase through to the ConnectyCube API. Their documentation states:

You need to create Firebase project_id and obtain Firebase access_token after SMS code verification, then pass these parameters to login method.

To log a user in with Phone auth and Firebase, I'm using the react-native-firebase package which works fine. It logs the user in to Firebase which I can see in the Firebase console. However, I cannot get it to return the so-called 'access-token'. The ConnectyCube documentation only refers to React setup and not React Native setup for Firebase to get the access code. react-native-firebase always returns a null verificationId which is required not to be null in the official Firebase docs which say I can get the access token using the third line of this code:

  componentDidUpdate(){
    const getCredential = async () => {
      const credential = await firebase.auth.PhoneAuthProvider.credential(confirmResult.verificationId, code);
      console.log('-----------------------------------------', credential);
    }
    this.state.confirmResult && getCredential()
  }

So does anyone with experience of React Native and Firebase know how I can get this access token? Many thanks in advance.

Mr. Robot
  • 1,334
  • 6
  • 27
  • 79

0 Answers0