Firebase.Auth.PhoneAuthProvider
Use phone number text messages to authenticate.
Summary
Allows developers to use the phone number and SMS verification codes to authenticate a user.
This class is not supported on tvOS and Desktop platforms.
The verification flow results in a PhoneAuthCredential that can be used to,
- Sign in to an existing phone number account/sign up with a new phone number
- Link a phone number to a current user. This provider will be added to the user.
- Update a phone number on an existing user.
- Re-authenticate an existing user. This may be needed when a sensitive operation requires the user to be recently logged in.
Possible verification flows: (1) User manually enters verification code.
- App calls VerifyPhoneNumber.
- Web verification page is displayed to user where they may need to solve a CAPTCHA. [iOS only].
- Auth server sends the verification code via SMS to the provided phone number. App receives verification id via CodeSent.
- User receives SMS and enters verification code in app's GUI.
- App uses user's verification code to call PhoneAuthProvider.GetCredential.
(2) SMS is automatically retrieved (Android only).
- App calls VerifyPhoneNumber with
autoVerifyTimeOutMs
> 0. - Auth server sends the verification code via SMS to the provided phone number.
- SMS arrives and is automatically retrieved by the operating system. PhoneAuthCredential is automatically created and passed to the app via VerificationCompleted.
(3) Phone number is instantly verified (Android only).
- App calls VerifyPhoneNumber.
- The operating system validates the phone number without having to send an SMS. PhoneAuthCredential is automatically created and passed to the app via VerificationCompleted.
Inheritance
Inherits from: SystemIDisposablePublic functions | |
---|---|
CodeAutoRetrievalTimeOut(string verificationId) | delegate void Callback used when a timeout occurs. |
CodeSent(string verificationId, ForceResendingToken forceResendingToken) | delegate void Callback used when a verification code is sent to the given number. |
Dispose() | void |
GetCredential(string verificationId, string verificationCode) | Generate a credential for the given phone number. |
VerificationCompleted(PhoneAuthCredential credential) | delegate void Callback used when phone number auto-verification succeeded. |
VerificationFailed(string error) | delegate void Callback used when phone number verification fails. |
VerifyPhoneNumber(PhoneAuthOptions options, VerificationCompleted verificationCompleted, VerificationFailed verificationFailed, CodeSent codeSent, CodeAutoRetrievalTimeOut codeAutoRetrievalTimeOut) | void Start the phone number authentication operation. |
Public static functions | |
---|---|
GetInstance(FirebaseAuth auth) | Return the PhoneAuthProvider for the specified auth . |
Public functions
CodeAutoRetrievalTimeOut
delegate void CodeAutoRetrievalTimeOut( string verificationId )
Callback used when a timeout occurs.
CodeSent
delegate void CodeSent( string verificationId, ForceResendingToken forceResendingToken )
Callback used when a verification code is sent to the given number.
Dispose
void Dispose()
VerificationCompleted
delegate void VerificationCompleted( PhoneAuthCredential credential )
Callback used when phone number auto-verification succeeded.
VerifyPhoneNumber
void VerifyPhoneNumber( PhoneAuthOptions options, VerificationCompleted verificationCompleted, VerificationFailed verificationFailed, CodeSent codeSent, CodeAutoRetrievalTimeOut codeAutoRetrievalTimeOut )
Start the phone number authentication operation.
Details | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
Public static functions
GetInstance
PhoneAuthProvider GetInstance( FirebaseAuth auth )
Return the PhoneAuthProvider for the specified auth
.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | a PhoneAuthProvider for the given auth object. |