UNPKG

voluptasmollitia

Version:
40 lines (25 loc) 1.2 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@firebase/auth](./auth.md) &gt; [updatePhoneNumber](./auth.updatephonenumber.md) ## updatePhoneNumber() function Updates the user's phone number. <b>Signature:</b> ```typescript export declare function updatePhoneNumber(user: User, credential: PhoneAuthCredential): Promise<void>; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | user | [User](./auth.user.md) | The user. | | credential | [PhoneAuthCredential](./auth.phoneauthcredential.md) | A credential authenticating the new phone number. | <b>Returns:</b> Promise&lt;void&gt; ## Example ``` // 'recaptcha-container' is the ID of an element in the DOM. const applicationVerifier = new RecaptchaVerifier('recaptcha-container'); const provider = new PhoneAuthProvider(auth); const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier); // Obtain the verificationCode from the user. const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode); await updatePhoneNumber(user, phoneCredential); ```