GoogleIdTokenCredential

public final class GoogleIdTokenCredential extends CustomCredential


Represents the user's Google ID Token granted by the user for app sign-in.

Throws
java.lang.NullPointerException

If any of id or idToken is null.

java.lang.IllegalArgumentException

If any of id or idToken is empty, or if the idToken is malformed or cannot be parsed.

Summary

Nested types

A builder for GoogleIdTokenCredential

Constants

static final @NonNull String

The constant used as a key in the SignInWithGoogleOption request and candidate data bundles, to distinguish SignInWithGoogleOption from GetGoogleIdTokenOption.

static final @NonNull String

A constant represents the type of Google ID Token Credential.

static final @NonNull String

A constant represents the type of Google ID Token Credential rerieved from SiWG button.

Public constructors

GoogleIdTokenCredential(
    @NonNull String id,
    @NonNull String idToken,
    String displayName,
    String familyName,
    String givenName,
    Uri profilePictureUri,
    String phoneNumber
)

Public methods

static final @NonNull GoogleIdTokenCredential
final String

display name to show on the entry.

final String

The user's email address, parsed from idToken.

final String

user's family name.

final String

user's given name.

final @NonNull String

DEPRECATED the email address associated with user's Google Account.

final @NonNull String

user's Google ID Token.

final String

DEPRECATED user's stored phone number.

final Uri

user's profile picture uri.

final @NonNull String

The user's unique Google account ID, parsed from idToken.

Inherited methods

From androidx.credentials.Credential

Constants

BUNDLE_KEY_GOOGLE_ID_TOKEN_SUBTYPE

public static final @NonNull String BUNDLE_KEY_GOOGLE_ID_TOKEN_SUBTYPE

The constant used as a key in the SignInWithGoogleOption request and candidate data bundles, to distinguish SignInWithGoogleOption from GetGoogleIdTokenOption. While both aforementioned options have the type TYPE_GOOGLE_ID_TOKEN_CREDENTIAL, SignInWithGoogleOption has a sub-type TYPE_GOOGLE_ID_TOKEN_SIWG_CREDENTIAL encoded against this key.

TYPE_GOOGLE_ID_TOKEN_CREDENTIAL

public static final @NonNull String TYPE_GOOGLE_ID_TOKEN_CREDENTIAL

A constant represents the type of Google ID Token Credential.

TYPE_GOOGLE_ID_TOKEN_SIWG_CREDENTIAL

public static final @NonNull String TYPE_GOOGLE_ID_TOKEN_SIWG_CREDENTIAL

A constant represents the type of Google ID Token Credential rerieved from SiWG button.

Public constructors

GoogleIdTokenCredential

public GoogleIdTokenCredential(
    @NonNull String id,
    @NonNull String idToken,
    String displayName,
    String familyName,
    String givenName,
    Uri profilePictureUri,
    String phoneNumber
)

Public methods

createFrom

public static final @NonNull GoogleIdTokenCredential createFrom(@NonNull Bundle data)

getDisplayName

public final String getDisplayName()

display name to show on the entry.

getEmail

public final String getEmail()

The user's email address, parsed from idToken.

getFamilyName

public final String getFamilyName()

user's family name.

getGivenName

public final String getGivenName()

user's given name.

getId

public final @NonNull String getId()

DEPRECATED the email address associated with user's Google Account.

getIdToken

public final @NonNull String getIdToken()

user's Google ID Token.

getPhoneNumber

public final String getPhoneNumber()

DEPRECATED user's stored phone number.

getProfilePictureUri

public final Uri getProfilePictureUri()

user's profile picture uri.

getUniqueId

public final @NonNull String getUniqueId()

The user's unique Google account ID, parsed from idToken.