Credential

public class Credential extends Object
implements Parcelable Parcelable

A credential that can be used to authenticate a user, with additional user information used to distinguish this credential from other available credentials. Credentials can be constructed using Credential.Builder. This is typically required when a credential is to be saved using Auth.CredentialsApi.save() for future retrieval after a new account is created, or the user changes their password.

Nested Class Summary

class Credential.Builder  

Constant Summary

String EXTRA_KEY The key for Credential values stored in a bundle or intent extra, typically in response to a resolution intent from request(GoogleApiClient, CredentialRequest).

Inherited Constant Summary

Field Summary

public static final Creator<Credential> CREATOR

Public Method Summary

boolean
equals(Object other)
String
getAccountType()
Returns the type of federated identity account used to sign in the user.
String
String
String
getId()
Returns the credential identifier.
List<IdToken>
getIdTokens()
Returns the ID tokens that assert the identity of the user, if available.
String
getName()
Returns the display name of the credential, if available.
String
getPassword()
Returns the password used to sign in the user.
Uri
getProfilePictureUri()
Returns the URL to an image of the user, if available.
int
void
writeToParcel(Parcel out, int flags)

Inherited Method Summary

Constants

public static final String EXTRA_KEY

The key for Credential values stored in a bundle or intent extra, typically in response to a resolution intent from request(GoogleApiClient, CredentialRequest).

Constant Value: "com.google.android.gms.credentials.Credential"

Fields

public static final Creator<Credential> CREATOR

Public Methods

public boolean equals (Object other)

public String getAccountType ()

Returns the type of federated identity account used to sign in the user. While this may be any string, it is strongly recommended that values from IdentityProviders are used, which are the login domains for common identity providers.

Returns
  • A string identifying the federated identity provider associated with this account, typically in the form of the identity provider's login domain. null will be returned if the credential is a password credential.

public String getFamilyName ()

Returns
  • the user's family name.

public String getGivenName ()

Returns
  • the user's given name.

public String getId ()

Returns the credential identifier. Typically this will be an email address, user name or phone number, though it may also be some encoded unique identifier for a federated identity account. Phone number identifiers will be normalized to the E.164 standard.

public List<IdToken> getIdTokens ()

Returns the ID tokens that assert the identity of the user, if available. ID tokens provide a secure mechanism to verify that the user owns the identity asserted by the credential.

This is useful for account hints, where the ID token can replace the need to separately verify that the user owns their claimed email address - with a valid ID token, it is not necessary to send an account activation link to the address, simplifying the account creation process for the user.

A signed ID token is returned automatically for credential hints when the credential ID is a Google account that is authenticated on the device. This ID token can be sent along with your application's account creation operation, where the signature can be verified.

public String getName ()

Returns the display name of the credential, if available. Typically, the display name will be the name of the user, or some other string which the user can easily recognize and distinguish from other accounts they may have.

public String getPassword ()

Returns the password used to sign in the user.

public Uri getProfilePictureUri ()

Returns the URL to an image of the user, if available.

public int hashCode ()

public void writeToParcel (Parcel out, int flags)