AuthenticationMode
public class AuthenticationMode
extension AuthenticationMode: NativeBase
extension AuthenticationMode: Hashable
This is a bearer authentication mode which adds or does not add a header (“Authorization”, “Bearer $Token”) to each online request of the module the object is added to. The token (if used) can be provided or is retrieved via key/secret from a dedicated backend.
-
This lambda is used to retrieve access token in synchronous manner. It returns the access token or null if it is not set. The lambda is called each time the access token is needed and it is executed on the main thread of the application.
Declaration
Swift
public typealias AccessTokenProvider = () -> String?Return Value
Access token in case it is set or null otherwise.
-
SDK will pass access token as a Bearer.
Declaration
Swift
public static func withToken(accessToken: String) -> AuthenticationModeParameters
accessTokenAccess token
Return Value
Instance of
AuthenticationModeconfigured to use token -
SDK will use access token provider to retrieve access token.
Declaration
Swift
public static func withTokenProvider(tokenProvider: @escaping AuthenticationMode.AccessTokenProvider) -> AuthenticationModeParameters
tokenProviderAccess token provider
Return Value
Instance of
AuthenticationModeconfigured to use token provider -
Assumes the authentication is provided by the client.
Declaration
Swift
public static func withExternal() -> AuthenticationModeReturn Value
Instance of
AuthenticationModeconfigured to use externally provided authentication -
SDK will authenticate with access key id access key secret to obtain authentication token.
Declaration
Swift
public static func withKeySecret(accessKeyId: String, accessKeySecret: String) -> AuthenticationModeParameters
accessKeyIdThe access key id
accessKeySecretThe access key secret
Return Value
Instance of
AuthenticationModeconfigured to use key ID and secret