question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cognito.user.signOut() does not invalidate tokens

See original GitHub issue

Describe the bug On calling state.cognito.user.signOut(), session tokens are just removed localstorage. The actual access tokens and refresh tokens are still valid for the lifecycle of the token.

Expected behavior This is a security issue. Best practice dictates session tokens should be invalidated server side on a logout request not just deleted on the client. (OWASP session management)

Source Code found here https://github.com/aws-amplify/amplify-js/blob/68a5ad2fe2b1d9f03cce80d1bf449e454b621760/packages/aws-amplify-react/src/Auth/SignOut.jsx

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:108
  • Comments:108 (11 by maintainers)

github_iconTop GitHub Comments

73reactions
cbernardescommented, Aug 24, 2019

We are all waiting for it to be fixed.

57reactions
mlabienieccommented, Jun 13, 2019

@jiachen247 Cognito issues short lived bearer access tokens (valid up to 1 hour). The access tokens are short lived (up to 1 hour) and Cognito has GlobalSignOut Api to invalidate all tokens issued in past. If you are using the cognito-identity-js sdk directly, then the globalSignOut method will invalidate all sessions (see use case #15 here: https://github.com/aws-amplify/amplify-js/tree/master/packages/amazon-cognito-identity-js). This i believe is what you are looking for to invalidate the server side. The user logout is specifically there as to not invalidate other sessions and just sign out the current local user.

cognitoUser.globalSignOut(callback);
Read more comments on GitHub >

github_iconTop Results From Across the Web

aws cognito invalidate token on logout - Stack Overflow
1 Answer 1 · 1 · The tokens are invalidated when used against the Cognito service. · @callo Is it possible to sign...
Read more >
Revoking tokens - Amazon Cognito - AWS Documentation
Revoked tokens can't be used with any Amazon Cognito API calls that require a token. However, revoked tokens will still be valid if...
Read more >
AWS Cognito User Pool Access Token Invalidation - DZone
Since the integrated tools in AWS Cognito aren't enough to invalidate a token once a sign out has been triggered, here's a helpful...
Read more >
Authentication - Sign out - Android - AWS Amplify Docs
Calling signout with globalSignOut = true will invalidate all the Cognito User Pool tokens of the signed in user. If the user is...
Read more >
How token revocation works in Cognito
Cognito offers a way to revoke a refresh_token and also to invalidate access_token s. But it doesn't magically solve the token invalidation ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found