doorman reference
A set of functions that you can use to build a custom auth flow.
doorman
is only used if you're building a fully-custom UI flow, rather than relying on withPhoneAuth
or the AuthFlow
.
It is recommended you use one withPhoneAuth
or AuthFlow
, but hey, it's your call!
What is this?
A key part of building a fully-custom auth flow is importing doorman
.
Table of contents
doorman.signInWithPhoneNumber
doorman.signInWithPhoneNumber
Arguments
Takes one argument: A dictionary with a
phoneNumber
fieldphoneNumber
format must be a string, trimmed, with no spaces, and only numbers, and a '+' at the beginning.
Returns
Promise: A dictionary with the following fields
success
booleanIf true, the SMS sent to the user, and you can navigate to the next screen.
error
string or undefinedIf there is a message, that means that there has been an error. This is a human-readable error description.
Full example
Below is the code from our example app on Github.
doorman.verifyCode
doorman.verifyCode
Arguments
Takes one argument: A dictionary with the following 2 required fields
phoneNumber
format must be a string, trimmed, with no spaces, and only numbers, and a '+' at the beginning.code
a 6-digit code, as a string. It must have no spaces.
Returns
Promise: a dictionary with the following fields
token
the custom auth token that has been added to your Firebase auth. It will exist if and only if yourcode
matches thephoneNumber
.You can use
firebase.auth().signInWithCustomToken(token)
message
string or undefinedIf there is a message, that means that there has been an error. This is a human-readable error description.
Full example
Below is the code from our example app on Github.
Last updated