Authenticator
public protocol Authenticator : AnyObject
A protocol for generic authentication strategies in Cisco Spark. Each authentication strategy is responsible for providing an accessToken used throughout this SDK.
Since
1.2.0-
Returns True if the user is logically authorized.
This may not mean the user has a valid access token yet, but the authentication strategy should be able to obtain one without further user interaction.
Since
1.2.0Declaration
Swift
var authorized: Bool { get }
-
Deauthorizes the current user and clears any persistent state with regards to the current user. If the phone is registered, it should be deregistered before calling this method.
Since
1.2.0Declaration
Swift
func deauthorize()
-
Returns an access token of this authenticator.
This may involve long-running operations such as service calls, but may also return immediately. The application should not make assumptions about how quickly this completes. If the access token could not be retrieved then the completion handler will be called with nil.
Since
1.2.0Declaration
Swift
func accessToken(completionHandler: @escaping (_ accessToken: String?) -> Void)
Parameters
completionHandler
a closure to be executed when completed, with the access token if successfuly retrieved, otherwise nil.
-
Refresh the access token of this authenticator.
Since
1.4.0Declaration
Swift
func refreshToken(completionHandler: @escaping (_ accessToken: String?) -> Void)
Parameters
completionHandler
a closure to be executed when completed, with the new access token if successfuly retrieved, otherwise nil.