1

I am trying out firebase auth signInWithPhoneNumber in my react-native app. Following https://rnfirebase.io/docs/master/auth/phone-auth. However on

firebase.auth().signInWithPhoneNumber(phoneNumber)
.then(confirmResult => {
  console.log(confirmResult)
}).catch(error => {
  console.log(error)
});

confirmResults doesn't have a confirm method.

ConfirmationResult {_auth: Auth {_app: App, _customUrlOrRegion: undefined, namespace: "auth", _user: null, _settings: null, …}
_verificationId: "AM5PThBgtChKnxaZPAnPE_9zR_4qd1p2YchqZLNexlWtTiBxkUhEoOd79z0oujNP9pYrs9rgUbTsluCnlsqFjJCdbv83d89vg9LhZXJWbsnTB6w8lmxn00OqVe8S_Qc3Pfnw2qHMgZzV"
verificationId: (...)
__proto__: Object

What am I doing wrong?

1 Answer 1

1

It looks like you're doing everything right. The console output shows that you are receiving an instance of a ConfirmationResult class.

When you perform console.log() on an instance of a class, the methods of that class aren't shown.

If you instead store that instance in a variable and then call confirmationResult.confirm() on that stored instance of the class, the confirm method will be called and the code supplied to confirm() will be verified.

See RNFirebase Phone Auth Docs for ConfirmationResult for more details about this class.

Sign up to request clarification or add additional context in comments.

2 Comments

Hey @Dheeraj i see this message Error: [auth/app-not-authorized] This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console
@DevAS Make sure the SHA-1 of the certificate you're using to sign your app are loaded into the firebase console under SHA-1 certificate fingerprints for your android app. You can view these using cd android && ./gradlew signingConfig. You can enter them by going to the settings in fhe firebase console or using this link (change YOUR_PROJECT with your project id)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.