OAuthAuthenticator
public class OAuthAuthenticator : Authenticator
An OAuth based authentication strategy for authenticating a user on Cisco Spark.
Since
1.2.0-
The delegate, which gets callbacks for refresh access token failure
Declaration
Swift
public weak var delegate: OAuthAuthenticatorDelegate?
-
See
See Authenticator.authorizedSince
1.2.0Declaration
Swift
public var authorized: Bool { get }
-
Declaration
Swift
public convenience init(clientId: String, clientSecret: String, scope: String, redirectUri: String, storage: OAuthStorage = OAuthKeychainStorage())
Parameters
clientId
the OAuth client id
clientSecret
the OAuth client secret
scope
space-separated string representing which permissions the application needs
redirectUri
the redirect URI that will be called when completing the authentication. This must match the redirect URI registered to your clientId.
storage
the storage mechanism for persisting authentication information
-
Brings up a web-based authorization view controller and directs the user through the OAuth process.
Since
1.2.0Declaration
Swift
public func authorize(parentViewController: UIViewController, completionHandler: ((_ success: Bool) -> Void)? = nil)
Parameters
parentViewController
the parent view controller for the OAuth view controller
completionHandler
the completion handler will be called when authentication is complete, with a boolean to indicate if the authentication process was successful. It will be called directly after the OAuth view controller has begun to dismiss itself in an animated way.
-
See
See Authenticator.accessToken(completionHandler:)Since
1.2.0Declaration
Swift
public func accessToken(completionHandler: @escaping (String?) -> Void)
-
See
See Authenticator.refreshToken(completionHandler:)Since
1.4.0Declaration
Swift
public func refreshToken(completionHandler: @escaping (String?) -> Void)
-
See
See Authenticator.deauthorize()Since
1.2.0Declaration
Swift
public func deauthorize()