OAuth2Module

Parent class of any OAuth2 module implementing generic OAuth2 authorization flow.

  • Initialize an OAuth2 module.

    Declaration

    Swift

    public required init(config: Config, session: OAuth2Session? = nil, requestSerializer: RequestSerializer = HttpRequestSerializer(), responseSerializer: ResponseSerializer = JsonResponseSerializer())

    Parameters

    config

    the configuration object that setups the module.

    session

    the session that that module will be bound to.

    requestSerializer

    the actual request serializer to use when performing requests.

    responseSerializer

    the actual response serializer to use upon receiving a response.

    Return Value

    the newly initialized OAuth2Module.

  • Request an authorization code.

    Declaration

    Swift

    public func requestAuthorizationCode(completionHandler: (AnyObject?, NSError?) -> Void)

    Parameters

    completionHandler

    A block object to be executed when the request operation finishes.

  • Request to refresh an access token.

    Declaration

    Swift

    public func refreshAccessToken(completionHandler: (AnyObject?, NSError?) -> Void)

    Parameters

    completionHandler

    A block object to be executed when the request operation finishes.

  • Exchange an authorization code for an access token.

    Declaration

    Swift

    public func exchangeAuthorizationCodeForAccessToken(code: String, completionHandler: (AnyObject?, NSError?) -> Void)

    Parameters

    code

    the ‘authorization’ code to exchange for an access token.

    completionHandler

    A block object to be executed when the request operation finishes.

  • Gateway to request authorization access.

    Declaration

    Swift

    public func requestAccess(completionHandler: (AnyObject?, NSError?) -> Void)

    Parameters

    completionHandler

    A block object to be executed when the request operation finishes.

  • Gateway to provide authentication using the Authorization Code Flow with OpenID Connect.

    Declaration

    Swift

    public func login(completionHandler: (AnyObject?, OpenIDClaim?, NSError?) -> Void)

    Parameters

    completionHandler

    A block object to be executed when the request operation finishes.

  • Request to revoke access.

    Declaration

    Swift

    public func revokeAccess(completionHandler: (AnyObject?, NSError?) -> Void)

    Parameters

    completionHandler

    A block object to be executed when the request operation finishes.

  • Return any authorization fields.

    Declaration

    Swift

    public func authorizationFields() -> [String: String]?

    Return Value

    a dictionary filled with the authorization fields.

  • Returns a boolean indicating whether authorization has been granted.

    Declaration

    Swift

    public func isAuthorized() -> Bool

    Return Value

    true if authorized, false otherwise.