openid_client icon indicating copy to clipboard operation
openid_client copied to clipboard

logout from the session

Open AtefIbrahim opened this issue 2 years ago • 1 comments

  1. how to logout from the session.
  2. can i read the session data while it is not expired.

AtefIbrahim avatar Mar 15 '22 15:03 AtefIbrahim

logout() async {
    var authenticator = await _getAuthenticator();
    authenticator.logout();
    window.localStorage.remove('openid_client:state');
    window.localStorage.remove('openid_client:auth');
    window.location.reload();
  }

TMSantos avatar Aug 30 '22 13:08 TMSantos

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.

rbellens avatar Dec 29 '22 14:12 rbellens