During Authentication
When you are authenticating users using Trusted Devices, Biometric or Pin, Cotter allows you to optionally request OAuth Tokens to be returned in addition to the Event token. The authentication_method
specified will be either TRUSTED_DEVICE
, BIOMETRIC
or PIN
.
Trusted Device Authentication
In the React Native SDK, you would follow this guide to request authentication using Trusted Devices. When the user successfully authenticated, either from a Trusted Device or when the user approved a login from a Non-Trusted Device, you would receive a JSON Response about the event and a signature.
To also receive OAuth Tokens, modify your code by adding getOAuthToken = true
in the parameters:
In the onRequestSuccess
, you'll receive the following response:
Cotter's React Native SDK automatically store your tokens securely inside the device's secure storage.
Tokens must be stored securely within your application.
Getting and Removing tokens from the Storage
You need to pass the access_token
to your backend server on every API calls. You also need to remove the tokens from storage to log out your users. Check out how to do that here:
Renewing Expired Tokens
Access tokens and ID tokens expires in 1 hour. When they're expired, you need to use the refresh_token
to get new tokens. Check out how to renew expired tokens:
Last updated