<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/auth](./auth.md) &gt; [PhoneAuthProvider](./auth.phoneauthprovider.md)

## PhoneAuthProvider class

Provider for generating an [PhoneAuthCredential](./auth.phoneauthcredential.md)<!-- -->.

<b>Signature:</b>

```typescript
export declare class PhoneAuthProvider 
```

## Example


```javascript
// '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);
const userCredential = await signInWithCredential(auth, phoneCredential);

```

## Constructors

|  Constructor | Modifiers | Description |
|  --- | --- | --- |
|  [(constructor)(auth)](./auth.phoneauthprovider._constructor_.md) |  | Constructs a new instance of the <code>PhoneAuthProvider</code> class |

## Properties

|  Property | Modifiers | Type | Description |
|  --- | --- | --- | --- |
|  [PHONE\_SIGN\_IN\_METHOD](./auth.phoneauthprovider.phone_sign_in_method.md) | <code>static</code> | (not declared) | Always set to [SignInMethod.PHONE](./auth.signinmethod.phone.md)<!-- -->. |
|  [PROVIDER\_ID](./auth.phoneauthprovider.provider_id.md) | <code>static</code> | (not declared) | Always set to [ProviderId.PHONE](./auth.providerid.phone.md)<!-- -->. |
|  [providerId](./auth.phoneauthprovider.providerid.md) |  | (not declared) | Always set to [ProviderId.PHONE](./auth.providerid.phone.md)<!-- -->. |

## Methods

|  Method | Modifiers | Description |
|  --- | --- | --- |
|  [credential(verificationId, verificationCode)](./auth.phoneauthprovider.credential.md) | <code>static</code> | Creates a phone auth credential, given the verification ID from [PhoneAuthProvider.verifyPhoneNumber()](./auth.phoneauthprovider.verifyphonenumber.md) and the code that was sent to the user's mobile device. |
|  [credentialFromError(error)](./auth.phoneauthprovider.credentialfromerror.md) | <code>static</code> | Returns an [AuthCredential](./auth.authcredential.md) when passed an error. |
|  [credentialFromResult(userCredential)](./auth.phoneauthprovider.credentialfromresult.md) | <code>static</code> | Generates an [AuthCredential](./auth.authcredential.md) from a [UserCredential](./auth.usercredential.md)<!-- -->. |
|  [verifyPhoneNumber(phoneOptions, applicationVerifier)](./auth.phoneauthprovider.verifyphonenumber.md) |  | Starts a phone number authentication flow by sending a verification code to the given phone number. |

