React-native-firebase: SMS code is always expired on real device iOS

Created on 4 Sep 2019  路  4Comments  路  Source: invertase/react-native-firebase

Issue

Hello everyone, I'm trying to impelment SMS verification on iOS. I checked previous issues but it was only reported for Android. I would like to mention that i tried both methods from docs (https://rnfirebase.io/docs/v5.x.x/auth/phone-auth) with same result.

What I would like to achieve?

SignIn already linked user with SMS provider

What am I doing?

I created mobile app with anonymous accounts for every user.
I addedd multiple signup methods like Facebook, Google etc (these providers are working correctly) and SMS.
I'm able to link anonymous account with SMS provider but after signout I'm starting to encounter errors (details below).

Linking anonymous user with SMS provider (working as exptected)

    .auth()
    .signInWithPhoneNumber(phoneNumber, Boolean(resend))

I'm saving verificationId from confirmationResult, redirecting user to other screen with input and after user enters verification code I'm using

const credential = firebase.auth.PhoneAuthProvider.credential(verificationId, code)
user.linkWithCredential(credential)

Then I'm signingOut with firebase:

firebase.auth().signOut()

And signing again with new verificationId and code received by my iPhone:

const credential = firebase.auth.PhoneAuthProvider.credential(verificationId, code)
firebase.auth().signInWithCredential(credential)

Each time I'm receiving: auth/code-expired error

Project Files

Everything is linked correctly, no need to paste my configs here as auth() package is available and all methods are working

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:

pod 'Firebase/Core', '~> 6.2.0'
pod 'Firebase/Auth', '~> 6.2.0'
## Environment
Click To Expand

**`react-native info` output:**

 "react-native": "0.59.10",
- **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [x ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `5.5.6` - **`Firebase` module(s) you're using that has the issue:** - `Auth` - **Are you using `TypeScript`?** - `Y`


Stale

Most helpful comment

Facing same issue on android and ios both , anybody help please ???

All 4 comments

I checked your native code and it seems that:

  • you're auto-linking user with confirmationResult.confirm method
  • additionally, you're calling signInWithCredential underneath and that's why my signIn will always throw an error

Which is breaking other provider signup/signin flow

EDIT:
Additional thing is that if I try to link account and then actually call confirmationResult.confirm - code will expire immediately

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.

Facing same issue on android and ios both , anybody help please ???

Was this page helpful?
0 / 5 - 0 ratings