public class TokenResponse extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TokenResponse.Builder
Creates instances of
TokenResponse . |
Modifier and Type | Field and Description |
---|---|
String |
accessToken
The access token, if provided.
|
Long |
accessTokenExpirationTime
The expiration time of the access token, if provided.
|
Map<String,String> |
additionalParameters
Additional, non-standard parameters in the response.
|
String |
idToken
The ID token describing the authenticated user, if provided.
|
String |
refreshToken
The refresh token, if provided.
|
TokenRequest |
request
The token request associated with this response.
|
String |
scope
The scope of the access token.
|
static String |
TOKEN_TYPE_BEARER
Indicates that a provided access token is a bearer token.
|
String |
tokenType
The type of the token returned.
|
Modifier and Type | Method and Description |
---|---|
static TokenResponse |
fromJson(JSONObject json)
Reads a token response from a JSON string produced by
toJson() . |
static TokenResponse |
fromJson(String jsonStr)
Reads a token response from a JSON string produced by
toJsonString() . |
static TokenResponse |
fromJson(TokenRequest request,
JSONObject json)
Reads a token response from a JSON string, and associates it with the provided request.
|
static TokenResponse |
fromJson(TokenRequest request,
String jsonStr)
Reads a token response from a JSON string, and associates it with the provided request.
|
Set<String> |
getScopeSet()
Derives the set of scopes from the consolidated, space-delimited scopes in the
scope field. |
JSONObject |
toJson()
Converts the token response to a JSON object, for storage or transmission.
|
String |
toJsonString()
Converts the token response to a JSON string, for storage or transmission.
|
public static final String TOKEN_TYPE_BEARER
@NonNull public final TokenRequest request
@Nullable public final String tokenType
TOKEN_TYPE_BEARER
, or some
other token type that the client has negotiated with the authorization service.@Nullable public final Long accessTokenExpirationTime
@Nullable public final String idToken
@Nullable public final String scope
@Nullable public Set<String> getScopeSet()
scope
field. If no scopes were specified on this response, the method will
return null
.public JSONObject toJson()
public String toJsonString()
@NonNull public static TokenResponse fromJson(@NonNull String jsonStr) throws JSONException
toJsonString()
.JSONException
- if the JSON is malformed or missing required fields.@NonNull public static TokenResponse fromJson(@NonNull JSONObject json) throws JSONException
toJson()
.JSONException
- if the JSON is malformed or missing required fields.@NonNull public static TokenResponse fromJson(@Nullable TokenRequest request, @NonNull String jsonStr) throws JSONException
toJsonString()
.JSONException
- if the JSON is malformed or missing required fields.@NonNull public static TokenResponse fromJson(@Nullable TokenRequest request, @NonNull JSONObject json) throws JSONException
toJson()
.JSONException
- if the JSON is malformed or missing required fields.