Logging out
In the React Native SDK, a user is treated as logged in as long as the user has an access token for the operation to be executed. Therefore, to logout the user, the access token needs to be revoked. This can be done by calling the logout
function. The plugin will remove the access token on the client, and also send a request to the IDAAS-core to invalidate the server side. If a refresh token is stored on the device, it will persist after the logout action. It can then be used to login again later.
Example code to log out a user
OneWelcomeSdk.logout()
.then(() => console.log('Logout succeed!'))
.catch(error => console.error('Logout failed: ', error.message))