chapeljuice
chapeljuice

Reputation: 886

AWS Cognito Token Expiring After 1 Hour

I'm using the AWS Cognito JavaScript SDK to authorize and authenticate users in my React Native app.

I've managed to provide and store an IdentityId for users. Users who do not log in have access to part of my app as long as we authorize them with a confirmation because of Federated Identities / IAM. This all works well.

My question is, after an hour the token is expiring and their access is being limited because of it. What should be the process here? Do I retrieve new tokens, or do some sort of token refresh? What does that look like?

There is so much AWS Cognito documentation out there but I haven't really been able to find exactly what I need; and on top of, that I'm finding it really confusing to tell what I need for a successful Federated Identities / IAM authorization flow vs. what I need for a successful User Pool / log in flow.

Upvotes: 6

Views: 5083

Answers (1)

UXDart
UXDart

Reputation: 2620

you have the credentials... and you called credentials.get() that first time... now on a timer after 55mins call credentials.refresh()... so you will have the credentials updated before they expire (do it every time you get a new credential... in 55mins refresh)

Upvotes: 5

Related Questions