OAuth2Error
public enum OAuth2Error : Error, CustomStringConvertible, Equatable
All errors that might occur.
The response errors return a description as defined in the spec: http://tools.ietf.org/html/rfc6749#section-4.1.2.1
-
An error for which we don’t have a specific one.
Declaration
Swift
case generic(String)
-
An error holding on to an NSError.
Declaration
Swift
case nsError(Foundation.NSError)
-
Invalid URL components, failed to create a URL
Declaration
Swift
case invalidURLComponents(URLComponents)
-
There is no client id.
Declaration
Swift
case noClientId
-
There is no client secret.
Declaration
Swift
case noClientSecret
-
There is no redirect URL.
Declaration
Swift
case noRedirectURL
-
There is no username.
Declaration
Swift
case noUsername
-
There is no password.
Declaration
Swift
case noPassword
-
The client is already authorizing.
Declaration
Swift
case alreadyAuthorizing
-
There is no authorization context.
Declaration
Swift
case noAuthorizationContext
-
The authorization context is invalid.
Declaration
Swift
case invalidAuthorizationContext
-
The auth configuration is invalid.
Declaration
Swift
case invalidAuthorizationConfiguration(String)
-
The redirect URL is invalid; with explanation.
Declaration
Swift
case invalidRedirectURL(String)
-
There is no access token.
Declaration
Swift
case noAccessToken
-
There is no refresh token.
Declaration
Swift
case noRefreshToken
-
There is no registration URL.
Declaration
Swift
case noRegistrationURL
-
The login controller does not have a valid type
Declaration
Swift
case invalidLoginController(actualType: String, expectedType: String)
-
There is no delegate associated with the password grant flow instance.
Declaration
Swift
case noPasswordGrantDelegate
-
The request is not using SSL/TLS.
Declaration
Swift
case notUsingTLS
-
Unable to open the authorize URL.
Declaration
Swift
case unableToOpenAuthorizeURL
-
The request is invalid. Passes the underlying error_description.
Declaration
Swift
case invalidRequest(String?)
-
The request was canceled.
Declaration
Swift
case requestCancelled
-
There was no token type in the response.
Declaration
Swift
case noTokenType
-
The token type is not supported. Passes the underlying error_description.
Declaration
Swift
case unsupportedTokenType(String)
-
There was no data in the response.
Declaration
Swift
case noDataInResponse
-
Some prerequisite failed; with explanation.
Declaration
Swift
case prerequisiteFailed(String)
-
The state parameter was missing in the response.
Declaration
Swift
case missingState
-
The state parameter was invalid.
Declaration
Swift
case invalidState
-
The JSON response could not be parsed.
Declaration
Swift
case jsonParserError
-
Unable to UTF-8 encode.
Declaration
Swift
case utf8EncodeError
-
Unable to decode to UTF-8.
Declaration
Swift
case utf8DecodeError
-
The client is unauthorized (HTTP status 401). Passes the underlying error_description.
Declaration
Swift
case unauthorizedClient(String?)
-
The request was forbidden (HTTP status 403).
Declaration
Swift
case forbidden
-
Username or password was wrong (HTTP status 403 on password grant).
Declaration
Swift
case wrongUsernamePassword
-
Access was denied. Passes the underlying error_description.
Declaration
Swift
case accessDenied(String?)
-
Response type is not supported. Passes the underlying error_description.
Declaration
Swift
case unsupportedResponseType(String?)
-
Scope was invalid. Passes the underlying error_description.
Declaration
Swift
case invalidScope(String?)
-
A 500 was thrown.
Declaration
Swift
case serverError
-
The service is temporarily unavailable. Passes the underlying error_description.
Declaration
Swift
case temporarilyUnavailable(String?)
-
Invalid grant. Passes the underlying error_description.
Declaration
Swift
case invalidGrant(String?)
-
Other response error, as defined in its String.
Declaration
Swift
case responseError(String)
-
Instantiate the error corresponding to the OAuth2 response code, if it is known.
Declaration
Swift
public static func fromResponseError(_ code: String, description: String? = nil, fallback: String? = nil) -> OAuth2Error
Parameters
code
The code, like “access_denied”, that should be interpreted
description
The description provided in the response
fallback
The error string to use in case the error code is not known
Return Value
An appropriate OAuth2Error
-
Human understandable error string.
Declaration
Swift
public var description: String { get }
-
Declaration
Swift
public static func == (lhs: OAuth2Error, rhs: OAuth2Error) -> Bool