DoormanProvider
The provider component that goes at the root of your app and wraps all other components.
The DoormanProvider
must wrap your entire app for Doorman to work, unless you are using withPhoneAuth
(which implements DoormanProvider
for you.)
Usage
Required Props
publicProjectId
Your Doorman project ID.
children
Any react node that's passed as a child.
Optional Props
initialPhoneNumber
(Optional) The initial state of the phone number field.
If you aren't based in the US, you may want to set this to the prefix of your country.
Default:
+1
which makes the initial flag 🇺🇸
onAuthStateChanged
follows the same API as the one from the Firebase Auth API.To see the docs for it, check here: https://firebase.google.com/docs/auth/web/manage-users
Basically, it's a function that gets called every time the user updates, whether signing in/out, or updating the user's token
You might want to use this for storing your user's UID in your database, or redux, etc.
onAuthStateChanged
example
onAuthStateChanged
exampleSay you're using redux, and want to update the user ID in your app:
Last updated