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
configthe configuration object that setups the module.
sessionthe session that that module will be bound to.
requestSerializerthe actual request serializer to use when performing requests.
responseSerializerthe 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
completionHandlerA 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
completionHandlerA 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
codethe ‘authorization’ code to exchange for an access token.
completionHandlerA 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
completionHandlerA 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
completionHandlerA block object to be executed when the request operation finishes.
-
Request to revoke access.
Declaration
Swift
public func revokeAccess(completionHandler: (AnyObject?, NSError?) -> Void)Parameters
completionHandlerA 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() -> BoolReturn Value
true if authorized, false otherwise.
View on GitHub
OAuth2Module Class Reference