User Token Management (v5)

Save and get the user token when you need it with the Apps Panel iOS SDK.

The iOS Apps Panel SDK provides a way to securely store the user token within your app, and to retrieve it when you need it.

Integration

There are no defined ways to get the user token from the back end. The usual way is to get as a response when the user logs into your app. Once you have made a call to get your user token from the web services, you can save it as follow:

try AuthenticationTokenManager.saveToken("TOKEN")

Once the token is saved, you just need to call useUserToken() on your request when you make a call that needs it:

let request = requestManager.request("path",
                                     method: .get,
                                     parameters: parameters)
request.useUserToken()
request.responseData() { result in
    /* ... */
}

If needed, you can retrieve the user token with the token() method of UserTokenManager.

Finally, you have the possibility to delete the user token. You should call this method at least when the user logs out of your app.

AuthenticationTokenManager.deleteToken()

What’s Next