Skip to content

SMS code AutoRetrieval #6209

Answered by mikehardy
salembaira asked this question in Q&A
Apr 22, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

if you listen to onAuthStateChanged, which passes a user parameter, and that user !== undefined, that means they have logged in via SMS auto-retrieval

https://rnfirebase.io/auth/usage#listening-to-authentication-state

So in a "normal" app where you have protected and unprotected screens, as soon as onAuthStateChanged is called with a valid user and you set that in to your state (or Context or whatever) then you'll immediately flip to your logged-in screens and be all set

A bit like so

https://github.com/invertase/react-native-firebase-authentication-example/blob/68bd37f8c219f892655b40c73e9818370f368b82/template/src/app/App.tsx#L36-L70

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@salembaira
Comment options

Answer selected by salembaira
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants