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
  • 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
  • The request is invalid.

    Declaration

    Swift

    case invalidRequest
  • The request was cancelled.

    Declaration

    Swift

    case requestCancelled
  • There was no token type in the response.

    Declaration

    Swift

    case noTokenType
  • The token type is not supported.

    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).

    Declaration

    Swift

    case unauthorizedClient
  • 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.

    Declaration

    Swift

    case accessDenied
  • Scope was invalid.

    Declaration

    Swift

    case invalidScope
  • A 500 was thrown.

    Declaration

    Swift

    case serverError
  • The service is temporarily unavailable.

    Declaration

    Swift

    case temporarilyUnavailable
  • 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, fallback: String? = nil) -> OAuth2Error

    Parameters

    code

    The code, like “access_denied”, that should be interpreted

    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
  • Declaration

    Swift

    public static func ==(lhs: OAuth2Error, rhs: OAuth2Error) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.