FirebasePhoneNumberVerification

Firebase Phone Number Verification, mirroring com.google.firebase.pnv.FirebasePhoneNumberVerification from the Firebase Android SDK (com.google.firebase:firebase-pnv): gets the phone number of a SIM in the device directly from its carrier, with a token signed by Firebase for your backend to verify, instead of sending an SMS code.

Phone Number Verification exists on Android only: Firebase has no iOS, web or Java SDK for it.

  • Android: the SDK itself. getVerifiedPhoneNumber (the extension, for common code, or the SDK's member taking an android.content.Context) needs an Activity.

  • iOS, macOS, tvOS, JS and Wasm: every task fails with UnsupportedOperationException and enableTestSession does nothing. Their members carry @UnsupportedOnApple or @UnsupportedOnJs, which warn where code compiled for those platforms calls them; keep an SMS sign-in (Firebase Authentication's phone sign-in) for them.

Firebase Phone Number Verification, mirroring com.google.firebase.pnv.FirebasePhoneNumberVerification from the Firebase Android SDK (com.google.firebase:firebase-pnv): gets the phone number of a SIM in the device directly from its carrier, with a token signed by Firebase for your backend to verify, instead of sending an SMS code.

Phone Number Verification exists on Android only: Firebase has no iOS, web or Java SDK for it.

  • Android: the SDK itself. getVerifiedPhoneNumber (the extension, for common code, or the SDK's member taking an android.content.Context) needs an Activity.

  • iOS, macOS, tvOS, JS and Wasm: every task fails with UnsupportedOperationException and enableTestSession does nothing. Their members carry @UnsupportedOnApple or @UnsupportedOnJs, which warn where code compiled for those platforms calls them; keep an SMS sign-in (Firebase Authentication's phone sign-in) for them.

Firebase Phone Number Verification, mirroring com.google.firebase.pnv.FirebasePhoneNumberVerification from the Firebase Android SDK (com.google.firebase:firebase-pnv): gets the phone number of a SIM in the device directly from its carrier, with a token signed by Firebase for your backend to verify, instead of sending an SMS code.

Phone Number Verification exists on Android only: Firebase has no iOS, web or Java SDK for it.

  • Android: the SDK itself. getVerifiedPhoneNumber (the extension, for common code, or the SDK's member taking an android.content.Context) needs an Activity.

  • iOS, macOS, tvOS, JS and Wasm: every task fails with UnsupportedOperationException and enableTestSession does nothing. Their members carry @UnsupportedOnApple or @UnsupportedOnJs, which warn where code compiled for those platforms calls them; keep an SMS sign-in (Firebase Authentication's phone sign-in) for them.

Firebase Phone Number Verification, mirroring com.google.firebase.pnv.FirebasePhoneNumberVerification from the Firebase Android SDK (com.google.firebase:firebase-pnv): gets the phone number of a SIM in the device directly from its carrier, with a token signed by Firebase for your backend to verify, instead of sending an SMS code.

Phone Number Verification exists on Android only: Firebase has no iOS, web or Java SDK for it.

  • Android: the SDK itself. getVerifiedPhoneNumber (the extension, for common code, or the SDK's member taking an android.content.Context) needs an Activity.

  • iOS, macOS, tvOS, JS and Wasm: every task fails with UnsupportedOperationException and enableTestSession does nothing. Their members carry @UnsupportedOnApple or @UnsupportedOnJs, which warn where code compiled for those platforms calls them; keep an SMS sign-in (Firebase Authentication's phone sign-in) for them.

Firebase Phone Number Verification, mirroring com.google.firebase.pnv.FirebasePhoneNumberVerification from the Firebase Android SDK (com.google.firebase:firebase-pnv): gets the phone number of a SIM in the device directly from its carrier, with a token signed by Firebase for your backend to verify, instead of sending an SMS code.

Phone Number Verification exists on Android only: Firebase has no iOS, web or Java SDK for it.

  • Android: the SDK itself. getVerifiedPhoneNumber (the extension, for common code, or the SDK's member taking an android.content.Context) needs an Activity.

  • iOS, macOS, tvOS, JS and Wasm: every task fails with UnsupportedOperationException and enableTestSession does nothing. Their members carry @UnsupportedOnApple or @UnsupportedOnJs, which warn where code compiled for those platforms calls them; keep an SMS sign-in (Firebase Authentication's phone sign-in) for them.

Types

Link copied to clipboard
actual object Companion
actual object Companion
expect object Companion
actual object Companion
actual object Companion

Functions

Link copied to clipboard
actual abstract fun enableTestSession(testNumberId: String)

Enables a test session with testNumberId, a test token generated in the Firebase console (Security, Phone Verification, Testing), so verification works without a SIM. Call it at most once per instance: on Android a second call throws a FirebasePhoneNumberVerificationException with FirebasePnvStatusCodes.TEST_SESSION_ALREADY_ENABLED, and an empty ID one with FirebasePnvStatusCodes.INVALID_TEST_NUMBER_ID.

actual abstract fun enableTestSession(testNumberId: String)

Does nothing: Phone Number Verification has no Apple SDK.

expect abstract fun enableTestSession(testNumberId: String)

Enables a test session with testNumberId, a test token generated in the Firebase console (Security, Phone Verification, Testing), so verification works without a SIM. Call it at most once per instance: on Android a second call throws a FirebasePhoneNumberVerificationException with FirebasePnvStatusCodes.TEST_SESSION_ALREADY_ENABLED, and an empty ID one with FirebasePnvStatusCodes.INVALID_TEST_NUMBER_ID.

actual abstract fun enableTestSession(testNumberId: String)

Does nothing: Phone Number Verification has no web SDK.

actual abstract fun enableTestSession(testNumberId: String)

Does nothing: Phone Number Verification has no web SDK.

Link copied to clipboard

Exchanges dcApiResponse, the Firebase token of the Credential Manager's response to the request built with getDigitalCredentialPayload, for the verified phone number and its Firebase PNV token. A successful exchange is billed.

Fails with UnsupportedOperationException: Phone Number Verification has no Apple SDK.

Exchanges dcApiResponse, the Firebase token of the Credential Manager's response to the request built with getDigitalCredentialPayload, for the verified phone number and its Firebase PNV token. A successful exchange is billed.

Fails with UnsupportedOperationException: Phone Number Verification has no web SDK.

Fails with UnsupportedOperationException: Phone Number Verification has no web SDK.

Link copied to clipboard
actual abstract fun getDigitalCredentialPayload(nonce: String): Task<String>

Starts a verification through your own Android Credential Manager request: returns the server-signed payload that goes into the request's Digital Credentials query. nonce is a single-use value your server generated; the request must carry the same one, and so does the resulting token. Pass the Credential Manager's response to exchangeCredentialResponseForPhoneNumber.

actual abstract fun getDigitalCredentialPayload(nonce: String): Task<String>

Fails with UnsupportedOperationException: Phone Number Verification has no Apple SDK.

expect abstract fun getDigitalCredentialPayload(nonce: String): Task<String>

Starts a verification through your own Android Credential Manager request: returns the server-signed payload that goes into the request's Digital Credentials query. nonce is a single-use value your server generated; the request must carry the same one, and so does the resulting token. Pass the Credential Manager's response to exchangeCredentialResponseForPhoneNumber.

actual abstract fun getDigitalCredentialPayload(nonce: String): Task<String>

Fails with UnsupportedOperationException: Phone Number Verification has no web SDK.

actual abstract fun getDigitalCredentialPayload(nonce: String): Task<String>

Fails with UnsupportedOperationException: Phone Number Verification has no web SDK.

Link copied to clipboard

Whether each SIM of the device supports verification, one result per SIM (in a test session, one for the test number). Asks the user for nothing; check it before offering verification, and fall back to SMS otherwise.

Whether the SIM in simSlot supports verification, as the one result of a list. The slot is 0 or 1; on Android another one throws IllegalArgumentException.

Fails with UnsupportedOperationException: Phone Number Verification has no Apple SDK.

Whether each SIM of the device supports verification, one result per SIM (in a test session, one for the test number). Asks the user for nothing; check it before offering verification, and fall back to SMS otherwise.

Whether the SIM in simSlot supports verification, as the one result of a list. The slot is 0 or 1; on Android another one throws IllegalArgumentException.

Fails with UnsupportedOperationException: Phone Number Verification has no web SDK.

Fails with UnsupportedOperationException: Phone Number Verification has no web SDK.

Link copied to clipboard

The SDK's Context member; the shipped extension of common code, which takes Any, binds to it.

Link copied to clipboard

Verifies the phone number of a SIM in the device: asks the user for consent through the Android Credential Manager, gets the number from the carrier, and returns it with its Firebase PNV token, which your backend verifies. A successful verification is billed.

Fails with UnsupportedOperationException: Phone Number Verification has no Apple SDK.

Verifies the phone number of a SIM in the device: asks the user for consent through the Android Credential Manager, gets the number from the carrier, and returns it with its Firebase PNV token, which your backend verifies. A successful verification is billed.

Fails with UnsupportedOperationException: Phone Number Verification has no web SDK.

Fails with UnsupportedOperationException: Phone Number Verification has no web SDK.