User Access Token

The user access token allows you to interact with the Sentiance API directly from within your app.

Get the User ID and Token

If a Sentiance user has been created, you can get the user ID and token as follows:

 Sentiance.shared.requestUserAccessToken { result, error in
    if let result = result {
        print("Token: \(result.token)")
    }
}

Failure

The token is normally valid for a limited time (several days). Generally, requesting a token from the SDK will complete instantly by returning a cached token. But if a new one has to be obtained from the Sentiance API, there is a possibility that it will fail (e.g. no network connection).

Use error.failureReason to know the failure reason in case of failure.

Last updated