@Immutable public class TokenErrorResponse extends TokenResponse implements ErrorResponse
Standard token errors:
OAuth2Error.INVALID_REQUEST
OAuth2Error.INVALID_CLIENT
OAuth2Error.INVALID_GRANT
OAuth2Error.UNAUTHORIZED_CLIENT
OAuth2Error.UNSUPPORTED_GRANT_TYPE
OAuth2Error.INVALID_SCOPE
Example HTTP response:
HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store Pragma: no-cache { "error": "invalid_request" }
Related specifications:
Modifier | Constructor and Description |
---|---|
protected |
TokenErrorResponse()
Creates a new OAuth 2.0 Access Token error response.
|
|
TokenErrorResponse(ErrorObject error)
Creates a new OAuth 2.0 Access Token error response.
|
Modifier and Type | Method and Description |
---|---|
ErrorObject |
getErrorObject()
Gets the error associated with the error response.
|
static Set<ErrorObject> |
getStandardErrors()
Gets the standard OAuth 2.0 errors for an Access Token error
response.
|
boolean |
indicatesSuccess()
Checks if the response indicates success.
|
static TokenErrorResponse |
parse(HTTPResponse httpResponse)
Parses an OAuth 2.0 Token Error response from the specified HTTP
response.
|
static TokenErrorResponse |
parse(net.minidev.json.JSONObject jsonObject)
Parses an OAuth 2.0 Token Error response from the specified JSON
object.
|
HTTPResponse |
toHTTPResponse()
Returns the matching HTTP response.
|
net.minidev.json.JSONObject |
toJSONObject()
Returns the JSON object for this token error response.
|
protected TokenErrorResponse()
public TokenErrorResponse(ErrorObject error)
error
- The error. Should match one of the
standard errors
for a token
error response. Must not be null
.public static Set<ErrorObject> getStandardErrors()
public boolean indicatesSuccess()
Response
indicatesSuccess
in interface Response
true
if the response indicates success, else
false
.public ErrorObject getErrorObject()
ErrorResponse
getErrorObject
in interface ErrorResponse
null
if none.public net.minidev.json.JSONObject toJSONObject()
public HTTPResponse toHTTPResponse()
Response
toHTTPResponse
in interface Response
public static TokenErrorResponse parse(net.minidev.json.JSONObject jsonObject) throws ParseException
jsonObject
- The JSON object to parse. Its status code must not
be 200 (OK). Must not be null
.ParseException
- If the JSON object couldn't be parsed to an
OAuth 2.0 Token Error response.public static TokenErrorResponse parse(HTTPResponse httpResponse) throws ParseException
httpResponse
- The HTTP response to parse. Its status code must
not be 200 (OK). Must not be null
.ParseException
- If the HTTP response couldn't be parsed to an
OAuth 2.0 Token Error response.Copyright © 2016 Connect2id Ltd.. All rights reserved.