|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<String,Object>
com.google.api.client.util.GenericData
com.google.api.client.auth.oauth2.AccessTokenRequest
AccessTokenRequest
@Deprecated public class AccessTokenRequest
OAuth 2.0 request for an access token as specified in Obtaining an Access Token.
This class may be used directly when no access grant is included, such as when the client is
requesting access to the protected resources under its control. Otherwise, use one of the
subclasses, which add custom parameters to specify the access grant. Call execute() to
execute the request from which the AccessTokenResponse may be parsed. On error, use
AccessTokenErrorResponse instead.
Sample usage when the client is requesting access to the protected resources under its control:
static void requestAccessToken() throws IOException {
try {
AccessTokenRequest request =
new AccessTokenRequest(new NetHttpTransport(), new JacksonFactory(),
"https://server.example.com/authorize", "s6BhdRkqt3", "gX1fBat3bV");
AccessTokenResponse response = request.execute().parseAs(AccessTokenResponse.class);
System.out.println("Access token: " + response.accessToken);
} catch (HttpResponseException e) {
AccessTokenErrorResponse response = e.response.parseAs(AccessTokenErrorResponse.class);
System.out.println("Error: " + response.error);
}
}
| Nested Class Summary | |
|---|---|
static class |
AccessTokenRequest.AssertionGrant
Deprecated. (scheduled to be removed in 1.5) Use AccessTokenRequest.AssertionGrant |
static class |
AccessTokenRequest.AuthorizationCodeGrant
Deprecated. (scheduled to be removed in 1.5) Use AccessTokenRequest.AuthorizationCodeGrant |
static class |
AccessTokenRequest.RefreshTokenGrant
Deprecated. (scheduled to be removed in 1.5) Use AccessTokenRequest.RefreshTokenGrant |
static class |
AccessTokenRequest.ResourceOwnerPasswordCredentialsGrant
Deprecated. (scheduled to be removed in 1.5) Use AccessTokenRequest.ResourceOwnerPasswordCredentialsGrant |
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary | |
|---|---|
String |
authorizationServerUrl
Deprecated. (REQUIRED) Encoded authorization server URL. |
String |
clientId
Deprecated. (REQUIRED, unless the client identity can be establish via other means, for example assertion) The client identifier or null for none. |
String |
clientSecret
Deprecated. (REQUIRED) The client secret. |
String |
grantType
Deprecated. (REQUIRED) The access grant type included in the request. |
JsonFactory |
jsonFactory
Deprecated. (REQUIRED) JSON factory to use for parsing response in execute(). |
String |
scope
Deprecated. (OPTIONAL) The scope of the access request expressed as a list of space-delimited strings or null for none. |
HttpTransport |
transport
Deprecated. (REQUIRED) HTTP transport required for executing request in execute(). |
boolean |
useBasicAuthorization
Deprecated. Defaults to true to use Basic Authentication as recommended in Client Password
Credentials, but may be set to false for for specifying the password in the request
body using the "clientSecret" parameter in the HTTP body. |
| Fields inherited from class com.google.api.client.util.GenericData |
|---|
unknownFields |
| Constructor Summary | |
|---|---|
AccessTokenRequest()
Deprecated. |
|
| Method Summary | |
|---|---|
HttpResponse |
execute()
Deprecated. Executes request for an access token, and returns the HTTP response. |
| Methods inherited from class com.google.api.client.util.GenericData |
|---|
clone, entrySet, get, put, putAll, remove, set |
| Methods inherited from class java.util.AbstractMap |
|---|
clear, containsKey, containsValue, equals, hashCode, isEmpty, keySet, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public HttpTransport transport
execute().
public JsonFactory jsonFactory
execute().
public String grantType
public String clientId
null for none.
public String clientSecret
public String scope
null for none. The value of the "scope" parameter is defined by the authorization
server. If the value contains multiple space-delimited strings, their order does not matter,
and each string adds an additional access range to the requested scope. If the access grant
being used already represents an approved scope (e.g. authorization code, assertion), the
requested scope MUST be equal or lesser than the scope previously granted.
public String authorizationServerUrl
public boolean useBasicAuthorization
true to use Basic Authentication as recommended in Client Password
Credentials, but may be set to false for for specifying the password in the request
body using the "clientSecret" parameter in the HTTP body.
| Constructor Detail |
|---|
public AccessTokenRequest()
| Method Detail |
|---|
public final HttpResponse execute()
throws IOException
HttpResponse.parseAs(Class) with
AccessTokenResponse
HttpResponseException - for an HTTP error response, which can then be parsed using
HttpResponse.parseAs(Class) on HttpResponseException.response using
AccessTokenErrorResponse
IOException - I/O exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||