@Immutable public class AccessTokenResponse extends TokenResponse implements SuccessResponse
Example HTTP response:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache
{
"access_token" : "2YotnFZFEjr1zCsicMWpAA",
"token_type" : "example",
"expires_in" : 3600,
"refresh_token" : "tGzv3JOkF0XG5Qx2TlKWIA",
"example_parameter" : "example_value"
}
Related specifications:
| Constructor and Description |
|---|
AccessTokenResponse(Tokens tokens)
Creates a new access token response.
|
AccessTokenResponse(Tokens tokens,
Map<String,Object> customParams)
Creates a new access token response.
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
getCustomParameters()
Returns the custom parameters.
|
Map<String,Object> |
getCustomParams()
Deprecated.
|
Tokens |
getTokens()
Returns the tokens.
|
boolean |
indicatesSuccess()
Checks if the response indicates success.
|
static AccessTokenResponse |
parse(HTTPResponse httpResponse)
Parses an access token response from the specified HTTP response.
|
static AccessTokenResponse |
parse(net.minidev.json.JSONObject jsonObject)
Parses an access token response from the specified JSON object.
|
HTTPResponse |
toHTTPResponse()
Returns the matching HTTP response.
|
net.minidev.json.JSONObject |
toJSONObject()
Returns a JSON object representation of this access token response.
|
public AccessTokenResponse(Tokens tokens)
tokens - The tokens. Must not be null.public AccessTokenResponse(Tokens tokens, Map<String,Object> customParams)
tokens - The tokens. Must not be null.customParams - Optional custom parameters, null if
none.public boolean indicatesSuccess()
ResponseindicatesSuccess in interface Responsetrue if the response indicates success, else
false.public Map<String,Object> getCustomParameters()
@Deprecated public Map<String,Object> getCustomParams()
public net.minidev.json.JSONObject toJSONObject()
Example JSON object:
{
"access_token" : "SlAV32hkKG",
"token_type" : "Bearer",
"refresh_token" : "8xLOxBtZp8",
"expires_in" : 3600
}
public HTTPResponse toHTTPResponse()
ResponsetoHTTPResponse in interface Responsepublic static AccessTokenResponse parse(net.minidev.json.JSONObject jsonObject) throws ParseException
jsonObject - The JSON object to parse. Must not be null.ParseException - If the JSON object couldn't be parsed to an
access token response.public static AccessTokenResponse parse(HTTPResponse httpResponse) throws ParseException
httpResponse - The HTTP response. Must not be null.ParseException - If the HTTP response couldn't be parsed to an
access token response.Copyright © 2017 Connect2id Ltd.. All rights reserved.