RestToken
public class RestToken
A RestToken object retrieves, stores, and refreshes an authentication token. The token is
retrieved at a particular URL using basic authentication credentials (i.e. username and password).
-
The string authentication token.
Declaration
Swift
public var token: String? -
Denotes whether the token is refreshing.
Declaration
Swift
public var isRefreshing: Bool -
Denotes the number of retries.
Declaration
Swift
public var retries: Int -
Create a
RestToken.Declaration
Swift
public init(tokenURL: String, username: String, password: String)Parameters
tokenURLThe URL that shall be used to obtain a token.
usernameThe username credential used to obtain a token.
passwordThe password credential used to obtain a token.
-
Refresh the authentication token.
Declaration
Swift
public func refreshToken( failure: ((Error) -> Void)? = nil, success: (() -> Void)? = nil)Parameters
failureA function executed if an error occurs.
successA function executed after a new token is retrieved.
View on GitHub
RestToken Class Reference