After the user Authenticates, the SDK automatically stores the Access Token and Refresh Token for your convenience. To get the access token:
var cotter =newCotter(API_KEY_ID)cotter.tokenHandler.getAccessToken().then(tok => {console.log(tok)})
This function automatically refreshes the access token if it's expired. The returned access token would be in the form of a CotterAccessToken object which contains both the string and the decoded token.
Get Logged-in User
After the user Authenticates, the SDK automatically stores the User Information. To get that information:
var cotter =newCotter(API_KEY_ID)var user =cotter.getLoggedInUser()console.log(user)
Log Out
To log out and remove these data, do the following:
var cotter =newCotter(API_KEY_ID)awaitcotter.logOut()
Update Refresh Token (for Custom Claims)
version >= 0.3.24
If you used this API to get custom claims, and you received a new refresh_token , you can update the refresh token stored in the user's browser by calling this method: