public static class

GoogleAuthTokenFactory.OAuth2Token

extends Object
implements HttpAuthToken
java.lang.Object
   ↳ com.google.gdata.client.GoogleAuthTokenFactory.OAuth2Token

Class Overview

Encapsulates the OAuth 2.0 information used by applications to login on behalf of a user.

Summary

Constants
String HEADER_PREFIX
Fields
final Credential credential
Public Constructors
GoogleAuthTokenFactory.OAuth2Token(Credential credential)
Public Methods
String getAuthorizationHeader(URL requestUrl, String requestMethod)
Returns the authorization header using the user's OAuth 2.0 credentials.
boolean refreshToken()
Use the Credential to request a new access token from the authorization endpoint.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gdata.client.http.HttpAuthToken

Constants

static final String HEADER_PREFIX

Constant Value: "Bearer "

Fields

final Credential credential

Public Constructors

public GoogleAuthTokenFactory.OAuth2Token (Credential credential)

Create a new GoogleAuthTokenFactory.OAuth2Token object. Store the Credential to use when generating the header.

Parameters
credential The required OAuth 2.0 credentials

Public Methods

public String getAuthorizationHeader (URL requestUrl, String requestMethod)

Returns the authorization header using the user's OAuth 2.0 credentials.

Parameters
requestUrl The URL being requested
requestMethod The HTTP method of the request
Returns
  • the authorization header to be used for the request

public boolean refreshToken ()

Use the Credential to request a new access token from the authorization endpoint.

Returns
  • whether a new access token was successfully retrieved