Auth.currentAuthenticatedUser should return error if user is signed out globally from backend (may be with aws cli).
See original GitHub issueDescribe the bug Auth.currentAuthenticatedUser returns CognitoUser evenif the access token for the user is invalidated from backend (i.e. signed out globally with aws cli which invalidated all the tokens including refresh token: https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/global-sign-out.html)
To Reproduce Steps to reproduce the behavior: 0. Have react application having basic functionality for signin/ signout/ home page etc…
- Signin using amplify sign in api
- U have the access, id, refresh token in ur configured storage.
- on componentDidMount call
Auth.currentAuthenticatedUser()
.then((session) => {
console.log("In then block");
})
.catch((error) => {
console.log("In catch block")
this.setState({validSession: false});
})
- get the access token from you configured storage use aws cli to signout globally. this will invalidate all your token.
- Refresh the page
Expected behavior Actually we want to automatically sign out the user from the application. so we are checking Auth.currentAuthenticatedUser() should return error but it still returns CognitoUser object.
Is there any other way to automatically signout in such case?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:10 (5 by maintainers)
Top Results From Across the Web
update-backend-auth — AWS CLI 1.27.32 Command Reference
Defines the service name to use when configuring an authentication resource in your Amplify project. UserPoolConfigs -> (structure). Describes the ...
Read more >How to Setup Authentication Fast with AWS Amplify
currentAuthenticatedUser () method to check if the user has been authenticated. If yes, it returns the user object. signOut - This function uses ......
Read more >Full Stack Cloud Development with AWS Amplify
This is done by calling the currentAuthenticatedUser method of the Auth class from Amplify. If there's a signed in user, this function returns...
Read more >Advanced workflows - Lambda Triggers - AWS Amplify Docs
The CLI Auth workflow provides the following Lambda trigger templates: ... that is returned when the user interacts with the Google reCaptcha component....
Read more >AWS Amplify, how to check if user is logged in? - Stack Overflow
I'm using the ionViewCanEnter() function in every page to allow/deny access. The return value of this function determines if the page can be ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @mmritesh
Can you try using
This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels or Discussions for those types of questions.