amazon-archives / aws-cognito-angular-quickstart

An Angular(v5)-based QuickStart single-page app utilizing Amazon Cognito, S3, and DynamoDB (Serverless architecture)
https://cognito.budilov.com
Apache License 2.0
689 stars 300 forks source link

When do the session expire? #39

Closed cedricleroy closed 7 years ago

cedricleroy commented 7 years ago

Quick question: Is the session ever expire? I have read that it should happen after one hour, however it looks like session.isValid() is always true. Is there an extra step needed somewhere?

vbudilov commented 7 years ago

Hi @cedricleroy ,

take a look at this issue: https://github.com/aws/amazon-cognito-identity-js/issues/131

Vladimir Budilov

akashbiz commented 7 years ago

@vbudilov it has been clear like token get expire in 1 hour from user login. I want to refresh the token after specific interval of time and I am doing that by calling getSession() method but not sure what should be the best interval time to do this? which will reduce my calls to cognito and also token will not get expire.

I have tried 60 minutes of interval but its not working because by the time I refresh the tokens are expired already. Also I have tried 15 minutes of interval and that works well but by this in single hour its refreshing 4 time and somehow I feel these calls can be reduced by increasing this interval time. Can you guide me more about this.

Thanks in advance.

Ricardonacif commented 6 years ago

@akashbiz did you find a proper solution?

akashbiz commented 6 years ago

@Ricardonacif , I have used getSession method as mentioned and after speaking with AWS engineers on chat they suggested to do it in eaither 15 minutes or 29 minutes of interval. There is no other solution is available apart from this. Hope this helps you.