During Email/Phone Verification
Cotter's email/phone number verification is generally used to check if the email or phone number is active. For websites with no companion app, it is also used as the main method of login.
Cotter can return OAuth tokens when the user's email/phone numbers are verified, and the authentication_method
will be set as OTP
.
In the React Native SDK, you would follow this guide to open Cotter's verification module. When the user's email or phone number is successfully verified, you'll receive information about the user and a signature from Cotter.
To also receive OAuth Tokens, modify your code by adding getOAuthToken = true
in the parameters:
The response OnSuccess
will be:
Cotter's React Native SDK automatically store your tokens securely inside the device's secure storage.
Tokens must be stored securely within your application Use Android Keystore for Android and iOS KeyChain for iOS apps.
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