Home > @firebase/auth > GoogleAuthProvider > credential
GoogleAuthProvider.credential() method
Creates a credential for Google. At least one of ID token and access token is required.
Signature:
static credential(idToken?: string | null, accessToken?: string | null): OAuthCredential;
Parameters
| Parameter | Type | Description | 
|---|---|---|
| idToken | string | null | Google ID token. | 
| accessToken | string | null | Google access token. | 
Returns:
Example
// \`googleUser\` from the onsuccess Google Sign In callback.
const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token);
const result = await signInWithCredential(credential);