public class

Credential

extends Object
implements Parcelable Parcelable
java.lang.Object
   ↳ com.google.android.gms.auth.api.credentials.Credential

Class Overview

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.

Summary

Nested Classes
class Credential.Builder  
Constants
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).
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<Credential> CREATOR
Public Methods
boolean equals(Object other)
String getAccountType()
Returns the type of federated identity account used to sign in the user.
String getFamilyName()
String getGeneratedPassword()
Returns the generated password for an account hint.
String getGivenName()
String getId()
Returns the credential identifier, typically an email address or user name, though it may also be some encoded unique identifier for a federated identity account.
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 hashCode()
void writeToParcel(Parcel out, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

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)

Parameters
other Object
Returns
boolean

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
String 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
String the user's family name.

public String getGeneratedPassword ()

Returns the generated password for an account hint.

Returns
String

public String getGivenName ()

Returns
String the user's given name.

public String getId ()

Returns the credential identifier, typically an email address or user name, though it may also be some encoded unique identifier for a federated identity account.

Returns
String

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.

Returns
List<IdToken>

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.

Returns
String

public String getPassword ()

Returns the password used to sign in the user.

Returns
String

public Uri getProfilePictureUri ()

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

Returns
Uri

public int hashCode ()

Returns
int

public void writeToParcel (Parcel out, int flags)

Parameters
out Parcel
flags int