voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
36 lines (21 loc) • 1.03 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[](./index.md) > [@firebase/auth](./auth.md) > [GoogleAuthProvider](./auth.googleauthprovider.md) > [credential](./auth.googleauthprovider.credential.md)
Creates a credential for Google. At least one of ID token and access token is required.
<b>Signature:</b>
```typescript
static credential(idToken?: string | null, accessToken?: string | null): OAuthCredential;
```
| Parameter | Type | Description |
| --- | --- | --- |
| idToken | string \| null | Google ID token. |
| accessToken | string \| null | Google access token. |
<b>Returns:</b>
[](./auth.oauthcredential.md)
```javascript
// \`googleUser\` from the onsuccess Google Sign In callback.
const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token);
const result = await signInWithCredential(credential);
```