public interface

CredentialsApi

com.google.android.gms.auth.api.credentials.CredentialsApi

Class Overview

Entry point for requesting a credential and indicating whether sign-in was successful using the credential. The default implementation of this interface can be accessed via Auth.CredentialsApi.

Summary

Constants
int ACTIVITY_RESULT_ADD_ACCOUNT Activity result code indicating that the flow ends up with user clicking on "add account" button.
int ACTIVITY_RESULT_OTHER_ACCOUNT Activity result code indicating that the user wishes to use a different account from what was presented in the credential or hint picker.
int CREDENTIAL_PICKER_REQUEST_CODE The default request code used for the PendingIntent returned from getHintPickerIntent().
Public Methods
abstract PendingResult<Status> delete(GoogleApiClient client, Credential credential)
Deletes a credential that is no longer valid for signing into the app.
abstract PendingResult<Status> disableAutoSignIn(GoogleApiClient client)
Disables auto sign-in for the calling app on the current device only, until a successful call to save is subsequently made.
abstract PendingIntent getHintPickerIntent(GoogleApiClient client, HintRequest request)
Provides an intent to directly display the hint picker to the user, to aid in new account creation.
abstract PendingResult<CredentialRequestResult> request(GoogleApiClient client, CredentialRequest request)
Tries to suggest a zero-click sign-in account.
abstract PendingResult<Status> save(GoogleApiClient client, Credential credential)
Saves a credential that was used to sign in to the app.

Constants

public static final int ACTIVITY_RESULT_ADD_ACCOUNT

Activity result code indicating that the flow ends up with user clicking on "add account" button.

Constant Value: 1000 (0x000003e8)

public static final int ACTIVITY_RESULT_OTHER_ACCOUNT

Activity result code indicating that the user wishes to use a different account from what was presented in the credential or hint picker.

Constant Value: 1001 (0x000003e9)

public static final int CREDENTIAL_PICKER_REQUEST_CODE

The default request code used for the PendingIntent returned from getHintPickerIntent().

Constant Value: 2000 (0x000007d0)

Public Methods

public abstract PendingResult<Status> delete (GoogleApiClient client, Credential credential)

Deletes a credential that is no longer valid for signing into the app.

Parameters
client GoogleApiClient
credential Credential
Returns
PendingResult<Status>

public abstract PendingResult<Status> disableAutoSignIn (GoogleApiClient client)

Disables auto sign-in for the calling app on the current device only, until a successful call to save is subsequently made. This is intended to be called when a user logs out of the app, to prevent a possible auto sign-in loop if the app's activity immediately calls the request method in its login activity.

Parameters
client GoogleApiClient
Returns
PendingResult<Status>

public abstract PendingIntent getHintPickerIntent (GoogleApiClient client, HintRequest request)

Provides an intent to directly display the hint picker to the user, to aid in new account creation.

WARNING: The identifier string of the credential returned by the hint picker should be treated as unverified. Do not accept plain user IDs for authentication -- they have not been verified and could be spoofed. If a Json Web Token is available (getIdTokens()) on the object returned from this request, it may contain a claim that the identifier has been verified by Google and this token can be passed to your backend server for validation and used for verification purposes.

Parameters
client GoogleApiClient
request HintRequest
Returns
PendingIntent

public abstract PendingResult<CredentialRequestResult> request (GoogleApiClient client, CredentialRequest request)

Tries to suggest a zero-click sign-in account. Only call this if your app does not currently know who is signed in.

Parameters
client GoogleApiClient
request CredentialRequest
Returns
PendingResult<CredentialRequestResult>

public abstract PendingResult<Status> save (GoogleApiClient client, Credential credential)

Saves a credential that was used to sign in to the app. If disableAutoSignIn was previously called and the save operation succeeds, auto sign-in will be re-enabled if the user's settings permit this.

Parameters
client GoogleApiClient
credential Credential
Returns
PendingResult<Status>