TokenAuthenticator

public class TokenAuthenticator : Authenticator

A custom Access Token based authentication strategy is to be used to authenticate with an application provided access token.

Since

3.2.0
  • Since

    1.2.0

    Declaration

    Swift

    public var authorized: Bool { get }
  • Creates a new Token authentication strategy for use with Access Tokens provied directly by applications

    Note

    If MDM profile is installed on the device, then isFedRAMPEnvironment property will be overriden by the value from the profile.

    Since

    3.2.0

    Declaration

    Swift

    public init(isFedRAMPEnvironment: Bool = false)
  • Sets the token on the authorization strategy, overriting any existing access token.

    Since

    3.2.0

    Declaration

    Swift

    public func authorizedWith(accessToken: String, expiryInSeconds: Int?, completionHandler: @escaping (_ result: AccessTokenLoginResult) -> Void)

    Parameters

    accessToken

    The new Access Token to use

    expiryInSeconds

    Optional expiry time of the token in seconds. This defaults to two days.

    completionHandler

    The completionHandler that is invoked after authorization with an AccessTokenLoginResult

  • 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

    3.2.0

    Declaration

    Swift

    public func accessToken(completionHandler: @escaping (Result<String>) -> Void)

    Parameters

    completionHandler

    a closure to be executed when completed, with the access token if successfully retrieved, otherwise nil.

  • See

    See Authenticator.deauthorize()

    Since

    3.2.0

    Declaration

    Swift

    public func deauthorize(completionHandler: (() -> Void)?)
  • The callback handler when auth token has expired. When a token expires, new instances of Webex and Authenticator need to be created and used with a new token

    Since

    3.2.0

    Declaration

    Swift

    public var onTokenExpired: (() -> Void)? { get set }