Auth.currentSession keeps calling https://cognito-idp.<region>.amazonaws.com/
See original GitHub issueDescribe the bug Whenever Auth.currentSession() is called, it will do a request to https://cognito-idp.us-east-1.amazonaws.com/ (AWSCognitoIdentityProviderService.GetUser). I think session should be cached until it expires.
To Reproduce Steps to reproduce the behavior: Call:
let session = await Auth.currentSession();
Check network tab in (say) Chrome and see new request to https://cognito-idp.us-east-1.amazonaws.com/ Headers:
Content-Type: application/x-amz-json-1.1
DNT: 1
Origin: http://localhost:3000
Referer: http://localhost:3000/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
X-Amz-Target: AWSCognitoIdentityProviderService.GetUser
X-Amz-User-Agent: aws-amplify/0.1.x js
Expected behavior Auth.currentSession() returns cached version until it has expired. Token info does get stored in local storage.
Additional context aws-amplify:1.14 aws-amplify-react: 2.0.5
config:
Amplify.configure({
Auth: {
mandatorySignIn: true,
identityPoolId: xxx,
region: xxx,
userPoolId: xxx,
userPoolWebClientId: xxx,
},
Analytics: {
disabled: true
}
});
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:13 (2 by maintainers)
Top Results From Across the Web
aws-amplify auth currentSession returns no current user
It looks like I cannot get user session, unless it is wrapped inside Auth.signIn. That's the Node/JS async programming model in a nutshell....
Read more >Authentication - Password & user management - JavaScript
Auth. currentSession() returns a CognitoUserSession object which contains JWT accessToken , idToken , and refreshToken . This method will automatically refresh ...
Read more >Retrieving user information from AWS Amplify authentication
This is a guide to three methods of retrieving user information from AWS Amplify authentication: Auth.currentSession(), Auth.
Read more >Amazon Cognito Authentication - Cypress Documentation
In this loginByCognitoApi command, we call Auth.signIn , then use that response to set the items inside of localStorage for the UI to...
Read more >Building an application with AWS Amplify, Amazon Cognito ...
The authorization header is what carries the id token. Caching is disabled in order to invoke the Lambda on every call and track...
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
@powerful23 Please consider filing this as a bug. The implementation leaks HTTP requests, which is obviously not intended. IME it is not a feature to have unintended behavior removed.
@kjellski hey we just had an internal discussion around this issue. We will take an action to resolve this in the next two days.