offline_access
scope included, it will return a that can be used to request a new token without asking for credentials again.
Credentials Manager
Auth0.swift provides a utility class to streamline the process of storing and renewing credentials. You can access theaccessToken
or idToken
properties from the Credentials instance. This is the preferred method to manage user credentials.
First import the Auth0
module:
import Auth0
Next present the page:
The Keychain items do not get deleted after your app is uninstalled. We recommend to always clear all of your app’s Keychain items on first launch.
Credentials Check
It can be useful to perform a quick check on app startup to ensure that you have renewable credentials stored in the manager. If not, the user can then be directed to authenticate.Retrieving User Credentials
You can retrieve the user’s credentials as follows:Result
containing either the credentials or an error.
Alternative Method - SimpleKeychain
This section is for developers who would prefer not to use the Credentials Manager. We include the SimpleKeychain utility –a light wrapper over the system Keychain– that can be used to store the tokens securely. First import theSimpleKeychain
module:
import SimpleKeychain
Next create an instance and store the tokens you need. In this case, you will store the access_token
and refresh_token
in the Keychain after a successful authentication.