openid_client
openid_client copied to clipboard
logout from the session
- how to logout from the session.
- can i read the session data while it is not expired.
logout() async {
var authenticator = await _getAuthenticator();
authenticator.logout();
window.localStorage.remove('openid_client:state');
window.localStorage.remove('openid_client:auth');
window.location.reload();
}
The answer of @TMSantos should be correct for web. Note, removing the local storage parameters is not necessary as this is done in the logout method. There was an issue, causing the logout url not being opened in all cases. This will be fixed in the next release.
For non web environment, you should be able to generate a logout url from the credential: credential.generateLogoutUrl()
, which you can open in a web browser. Also make sure to remove any stored credentials if you store it somewhere in the app.