Logging out
In the Flutter Plugin, a user is treated as logged in as long as the user has an access token for the operation to be executed. Therefore, to log out the user, the access token needs to be removed. 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 Mobile Identity side.
Example code to logout a user
await Onegini.instance.userClient
.logout()
.catchError((error) {
print("Logout failed: " + error.message);
});
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.