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).
The operating system validates the phone number without having to send an SMS. PhoneAuthCredential is automatically created and passed to the app via VerificationCompleted.
The id returned when sending the verification code. Sent to the caller via Listener::OnCodeSent.
verification_code
The verification code supplied by the user, most likely by a GUI where the user manually enters the code received in the SMS sent by VerifyPhoneNumber.
Phone number auto-verification succeeded. Called when auto-sms-retrieval or instant validation succeeds. Provided with the completed credential.
verificationFailed
Phone number verification failed with an error. For example, quota exceeded or unknown phone number format. Provided with a description of the error.
codeSent
SMS message with verification code sent to phone number. Provided with the verification id to pass along to GetCredential along with the sent code, and a token to use if the user requests another SMS message be sent.
codeAutoRetrievalTimeOut
The timeout specified has expired. Provided with the verification id for the transaction that timed out.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-05-09 UTC."],[],[],null,["Firebase.Auth.PhoneAuthProvider\n\nUse phone number text messages to authenticate.\n\nSummary\n\nAllows developers to use the phone number and SMS verification codes to authenticate a user.\n\nThis class is not supported on tvOS and Desktop platforms.\n\nThe verification flow results in a [PhoneAuthCredential](/docs/reference/unity/class/firebase/auth/phone-auth-credential#class_firebase_1_1_auth_1_1_phone_auth_credential) that can be used to,\n\n- Sign in to an existing phone number account/sign up with a new phone number\n- Link a phone number to a current user. This provider will be added to the user.\n- Update a phone number on an existing user.\n- Re-authenticate an existing user. This may be needed when a sensitive operation requires the user to be recently logged in.\n\n\u003cbr /\u003e\n\nPossible verification flows: (1) User manually enters verification code.\n\n- App calls [VerifyPhoneNumber](/docs/reference/unity/class/firebase/auth/phone-auth-provider#class_firebase_1_1_auth_1_1_phone_auth_provider_1a9428bdf467d2213b96e3b7f279dc8562).\n- Web verification page is displayed to user where they may need to solve a CAPTCHA. \\[iOS only\\].\n- [Auth](/docs/reference/unity/namespace/firebase/auth#namespace_firebase_1_1_auth) server sends the verification code via SMS to the provided phone number. App receives verification id via [CodeSent](/docs/reference/unity/class/firebase/auth/phone-auth-provider#class_firebase_1_1_auth_1_1_phone_auth_provider_1a96f9a8f73784ca4c9ebe01e571ab218f).\n- User receives SMS and enters verification code in app's GUI.\n- App uses user's verification code to call [PhoneAuthProvider.GetCredential](/docs/reference/unity/class/firebase/auth/phone-auth-provider#class_firebase_1_1_auth_1_1_phone_auth_provider_1ad450508b8b6fef8fdb532be6ebce9b20).\n\n\u003cbr /\u003e\n\n(2) SMS is automatically retrieved (Android only).\n\n- App calls [VerifyPhoneNumber](/docs/reference/unity/class/firebase/auth/phone-auth-provider#class_firebase_1_1_auth_1_1_phone_auth_provider_1a9428bdf467d2213b96e3b7f279dc8562) with `autoVerifyTimeOutMs` \\\u003e 0.\n- [Auth](/docs/reference/unity/namespace/firebase/auth#namespace_firebase_1_1_auth) server sends the verification code via SMS to the provided phone number.\n- SMS arrives and is automatically retrieved by the operating system. [PhoneAuthCredential](/docs/reference/unity/class/firebase/auth/phone-auth-credential#class_firebase_1_1_auth_1_1_phone_auth_credential) is automatically created and passed to the app via [VerificationCompleted](/docs/reference/unity/class/firebase/auth/phone-auth-provider#class_firebase_1_1_auth_1_1_phone_auth_provider_1a64e9a7b72b2cf3f5e6da45b08b8ee66d).\n\n\u003cbr /\u003e\n\n(3) Phone number is instantly verified (Android only).\n\n- App calls [VerifyPhoneNumber](/docs/reference/unity/class/firebase/auth/phone-auth-provider#class_firebase_1_1_auth_1_1_phone_auth_provider_1a9428bdf467d2213b96e3b7f279dc8562).\n- The operating system validates the phone number without having to send an SMS. [PhoneAuthCredential](/docs/reference/unity/class/firebase/auth/phone-auth-credential#class_firebase_1_1_auth_1_1_phone_auth_credential) is automatically created and passed to the app via [VerificationCompleted](/docs/reference/unity/class/firebase/auth/phone-auth-provider#class_firebase_1_1_auth_1_1_phone_auth_provider_1a64e9a7b72b2cf3f5e6da45b08b8ee66d).\n\n\u003cbr /\u003e\n\nInheritanceInherits from: SystemIDisposable\n\nPublic functions \n\nCodeAutoRetrievalTimeOut \n\n```c#\ndelegate void CodeAutoRetrievalTimeOut(\n string verificationId\n)\n``` \nCallback used when a timeout occurs. \n\nCodeSent \n\n```c#\ndelegate void CodeSent(\n string verificationId,\n ForceResendingToken forceResendingToken\n)\n``` \nCallback used when a verification code is sent to the given number. \n\nDispose \n\n```c#\nvoid Dispose()\n``` \n\nGetCredential \n\n```c#\nPhoneAuthCredential GetCredential(\n string verificationId,\n string verificationCode\n)\n``` \nGenerate a credential for the given phone number.\n\n\u003cbr /\u003e\n\nVerificationCompleted \n\n```c#\ndelegate void VerificationCompleted(\n PhoneAuthCredential credential\n)\n``` \nCallback used when phone number auto-verification succeeded. \n\nVerificationFailed \n\n```c#\ndelegate void VerificationFailed(\n string error\n)\n``` \nCallback used when phone number verification fails. \n\nVerifyPhoneNumber \n\n```c#\nvoid VerifyPhoneNumber(\n PhoneAuthOptions options,\n VerificationCompleted verificationCompleted,\n VerificationFailed verificationFailed,\n CodeSent codeSent,\n CodeAutoRetrievalTimeOut codeAutoRetrievalTimeOut\n)\n``` \nStart the phone number authentication operation.\n\n\n| **Note:** On iOS the verificationCompleted callback is never invoked and the codeAutoRetrievalTimeOut callback is invoked immediately since auto-validation is not supported on that platform.\n\n\u003cbr /\u003e\n\nPublic static functions \n\nGetInstance \n\n```c#\nPhoneAuthProvider GetInstance(\n FirebaseAuth auth\n)\n``` \nReturn the [PhoneAuthProvider](/docs/reference/unity/class/firebase/auth/phone-auth-provider#class_firebase_1_1_auth_1_1_phone_auth_provider) for the specified `auth`.\n\n\u003cbr /\u003e"]]