Package com.auth0.exception
Class APIException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
com.auth0.exception.Auth0Exception
com.auth0.exception.APIException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
RateLimitException
Represents an Auth0 Server error captured from an HTTP response. Provides different methods to determine why the request failed.
i.e.:
{
statusCode: 400,
description: "Query validation error: 'String 'users' does not match pattern. Must be a comma separated list of the following values: name,strategy,options,enabled_clients,id,provisioning_ticket_url' on property fields (A comma separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields).",
error: "invalid_query_string"
}
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAPIException(String payload, int statusCode, Throwable cause) APIException(Map<String, Object> values, int statusCode) -
Method Summary
Modifier and TypeMethodDescriptionGetter for the exception user friendly description of why the request failed.getError()Getter for the exception error code.intGetter for the Http Status Code received in the response.Returns a value from the error map, if any.booleanbooleanbooleanbooleanbooleanbooleanMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
APIException
-
APIException
-
-
Method Details
-
getStatusCode
public int getStatusCode()Getter for the Http Status Code received in the response. i.e. astatus_code=403would mean that the token has an insufficient scope.- Returns:
- the status code.
-
getError
Getter for the exception error code. i.e. aerror=invalid_query_stringwould mean that the query parameters sent in the request were invalid.- Returns:
- the error code.
-
getValue
Returns a value from the error map, if any.- Parameters:
key- key of the value to return- Returns:
- the value if found or null
-
getDescription
Getter for the exception user friendly description of why the request failed. i.e. the description may say which query parameters are valid for that endpoint.- Returns:
- the description.
-
isMultifactorRequired
public boolean isMultifactorRequired()- Returns:
truewhen an MFA code is required to authenticate,falseotherwise.
-
isInvalidCredentials
public boolean isInvalidCredentials()- Returns:
truewhen the username and/or password used for authentication are invalid,falseotherwise.
-
isMultifactorEnrollRequired
public boolean isMultifactorEnrollRequired()- Returns:
truewhen MFA is required and the user is not enrolled,falseotherwise.
-
isVerificationRequired
public boolean isVerificationRequired()- Returns:
truewhen Bot Protection flags the request as suspicious,falseotherwise.
-
isMultifactorTokenInvalid
public boolean isMultifactorTokenInvalid()- Returns:
truewhen the MFA Token used on the login request is malformed or has expired,falseotherwise.
-
isAccessDenied
public boolean isAccessDenied()- Returns:
truewhen authenticating with web-based authentiction and the resource server denied access per the OAuth 2 spec,falseotherwise.
-