AuthorizationClient

public interface AuthorizationClient implements HasApiKey<AuthorizationOptions>

A client for the authorization API.

Public Method Summary

abstract Task<AuthorizationResult>
authorize(AuthorizationRequest request)
Requests authorization to access the Google data associated with a signed-in account on the device.
abstract Task<Void>
clearToken(ClearTokenRequest request)
Clears an access token from the local cache.
abstract AuthorizationResult
getAuthorizationResultFromIntent(Intent data)
Retrieves the AuthorizationResult from the Intent returned upon successful authorization, throwing an ApiException if no result is present or authorization has failed.
abstract Task<Void>
revokeAccess(RevokeAccessRequest request)
Revokes access given to the current application.

Public Methods

public abstract Task<AuthorizationResult> authorize (AuthorizationRequest request)

Requests authorization to access the Google data associated with a signed-in account on the device.

If an eligible signed-in account is found for the application, this request will verify that all the requested OAuth 2.0 scopes were previously granted by the user. If they were, the requested tokens will be returned in the result. If, however, no saved account is found or the required grants do not exist, the result will contain a PendingIntent that can be used to launch the authorization flow. During that flow, the user will be asked to select an account and/or grant the permission for all or a subset of requested scopes. An exception will be set on the returned Task if authorization is not available on the device (for example, internal error or Play Services not available).

Parameters
request configuration for the authorization operation.
Returns
  • Task which contains the result of the operation.

public abstract Task<Void> clearToken (ClearTokenRequest request)

Clears an access token from the local cache.

Parameters
request configuration for the clear token operation.
Returns
  • A Task that may be used to check for failure, success or completion

public abstract AuthorizationResult getAuthorizationResultFromIntent (Intent data)

Retrieves the AuthorizationResult from the Intent returned upon successful authorization, throwing an ApiException if no result is present or authorization has failed.

Throws
ApiException

public abstract Task<Void> revokeAccess (RevokeAccessRequest request)

Revokes access given to the current application. Future sign-in or authorization attempts will require the user to re-consent to all requested scopes. Applications are required to provide users that are signed in with Google the ability to disconnect their Google account from the app. If the user deletes their account, you must delete the information that your app obtained from the Google APIs.

Parameters
request configuration for the revoke authorization operation.
Returns
  • A Task that may be used to check for failure, success or completion