Skip to content

signInWithPhoneNumber is not exported in React Native #5638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
byCedric opened this issue Oct 19, 2021 · 25 comments
Closed

signInWithPhoneNumber is not exported in React Native #5638

byCedric opened this issue Oct 19, 2021 · 25 comments
Assignees

Comments

@byCedric
Copy link

[REQUIRED] Describe your environment

  • Operating System version: Windows 11 Pro (21H2) / MacOS BigSur (11.6)
  • Browser version: Expo 42 - RN 0.63.3 / Expo 43 (beta) - RN 0.64.2
  • Firebase SDK version: 9.1.3
  • Firebase Product: auth

[REQUIRED] Describe the problem

Steps to reproduce:

It looks like the signInWithPhoneNumber and/or other methods and classes like PhoneAuthProvider are not exported in React Native environments.

At Expo, we have a native library to have a working recaptcha (as mentioned in the docs). But without these methods, we won't be able to let people use this way of authentication.

(Disclaimer, I work for Expo)

Relevant Code:

import { signInWithCredential, signInWithPhoneNumber, PhoneAuthProvider } from 'firebase/auth';

// This seems to work fine in Expo/RN
typeof signInWithCredential === 'function'

// These methods are missing
typeof signInWithPhoneNumber === 'undefined'
typeof PhoneAuthProvider  === 'undefined'

I also made a Snack so you can see the differences between web and android/ios. On web, all 3 types are functions but on android/ios, only the first one is a function.

@flygomel
Copy link

same issue
PhoneAuthProvider not exported
can't move on

@edi
Copy link

edi commented Oct 24, 2021

Same here, we've worked for a week to port the entire app to v9, just to realize at the end when porting auth that our only signing in method does not work.

@innonguyen
Copy link

I confirmed the same problem.

undefined is not a function when importing signInWithPhoneNumber

@dqii
Copy link

dqii commented Oct 25, 2021

+1

@innonguyen
Copy link

@sam-gc Can we have hot fix for this? This is a critical issue. My project is waiting for it to have new release, we should not hold this CR.

@edi
Copy link

edi commented Oct 26, 2021

@sam-gc Can we have hot fix for this? This is a critical issue. My project is waiting for it to have new release, we should not hold this CR.

Same on our end. Spent time porting everything to v9 just to find out phone auth isn’t working. Basically stabding by for a fix

@morganlaneap
Copy link

+1 for this, fresh install of Expo with Firebase, not exported :/

@sean-m-oleary
Copy link

+1 here. Can't use v9

@sean-m-oleary
Copy link

FYI there is a similar issue for the googleprovider and the email provider . Dead in the water here. Help!!!

@innonguyen
Copy link

@jbalidiong @sam-gc Please have some response on planning or let us know you're working on it.

Besides, You should remove V9 modular on official website if it's not ready yet. Other developers will be affected.

@edi
Copy link

edi commented Oct 27, 2021

@innonguyen From what I’ve heard, PhoneAuth is not going to be supported by the new modular SDK (though I hope @Feiyang1 is wrong here). Nor I’ve gotten any reasoning as to why it wouldn’t be supported anymore.

That doesn’t explain why some methods from the EmailProvider, so they just might be affectwd by the same issue here.

Hoping they’re all supported, since I for one can’t think of an actual limitation ..

@sam-gc
Copy link
Contributor

sam-gc commented Oct 27, 2021

Hi folks, I'm actively working on this, we will export the missing symbols for phone.

@sean-m-oleary, what symbol is missing? EmailAuthProvider is exported by the RN entrypoint, as is GoogleAuthProvider

@sean-m-oleary
Copy link

sean-m-oleary commented Oct 27, 2021

@sam-gc for the email login it's actually a local storage setitem undefined error. It looks like you already fixed it possibly in #5635 ? Is that released yet?

As for the Google error I will reproduce and add here shortly.

@sam-gc
Copy link
Contributor

sam-gc commented Oct 27, 2021

The browserLocalPersistence symbol shouldn't be exported in React Native at all (at least for mobile builds). I'm not sure why that's showing up and causing issues. @sean-m-oleary would you mind creating a separate issue for that problem and include some sample code (I'm unable to reproduce at the moment).

We're going to export the Phone auth symbols in the RN build so those should be available going forward.

@edi
Copy link

edi commented Oct 27, 2021

@sam-gc do we have an ETA for 9.1.4 release date?

As for sean’s EmailProvider, I must say it works fine for us, not really sure what his issue is.

@sean-m-oleary
Copy link

sean-m-oleary commented Oct 27, 2021 via email

@sam-gc
Copy link
Contributor

sam-gc commented Oct 29, 2021

@edi The phone auth symbols and functionality are now exported as of the latest release (9.2.0)

@sam-gc sam-gc closed this as completed Oct 29, 2021
@luklew
Copy link

luklew commented Nov 1, 2021

I upgraded to 9.2.0 and get error:

verifier._reset is not a function

I am using the expo provided example.

@sam-gc
Copy link
Contributor

sam-gc commented Nov 2, 2021

@luklew I think this is the same issue as #5688. The ReCaptcha verifier that expo exports will need to be updated to expose a _reset() function. In v8 this was named reset(). In both cases it's an internal undocumented method (which is why in v9 it was updated to follow our internal naming scheme).

Tagging @byCedric for visibility

@luklew
Copy link

luklew commented Nov 2, 2021

@luklew I think this is the same issue as #5688. The ReCaptcha verifier that expo exports will need to be updated to expose a _reset() function. In v8 this was named reset(). In both cases it's an internal undocumented method (which is why in v9 it was updated to follow our internal naming scheme).

Tagging @byCedric for visibility

Will that be a quick enough job or should we all downgrade for now?

@edi
Copy link

edi commented Nov 2, 2021

@luklew you can work around this by simply adding the following to your code:

verifier._reset = () => {}

@luklew
Copy link

luklew commented Nov 3, 2021

@luklew you can work around this by simply adding the following to your code:

verifier._reset = () => {}

@edi where would I add this? Thanks.

@edi
Copy link

edi commented Nov 3, 2021

@luklew Inside the method you're passing phone number the verifier for sending the SMS.
So, you pick up the user's number, and you pass the recaptcha verifier towards a method which calls the following:

provider.verifyPhoneNumber(number, verifier)

Somewhere before this line, you should add the following:

verifier._reset = () => {}

@luklew
Copy link

luklew commented Nov 3, 2021

@luklew Inside the method you're passing phone number the verifier for sending the SMS. So, you pick up the user's number, and you pass the recaptcha verifier towards a method which calls the following:

provider.verifyPhoneNumber(number, verifier)

Somewhere before this line, you should add the following:

verifier._reset = () => {}

@edi Im getting another error now:

undefined is not an object (evaluating auth.tenantId)

@edi
Copy link

edi commented Nov 3, 2021

A different issue requires a different thread. Also, without an actual snack to check, it's hard to figure out. For me, it works. Open a different thread with all the details, and hopefully others will answer, otherwise, downgrade to 41 / 42 and be done with it.

@firebase firebase locked and limited conversation to collaborators Nov 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests