Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to modify expiry time of the access and identity tokens for AWS Cognito User Pools

I can't find any documentation which explains if and how to modify the expiry time of access and identity tokens for AWS Cognito User Pools.

The documentation specifies that by default expires 1h after the emission.

Is there a way to modify the expiry time?

like image 362
Luca Avatar asked Mar 10 '17 07:03

Luca


People also ask

How long do Cognito access tokens last?

Access tokens can be configured to expire in as little as five minutes or as long as 24 hours. Refresh tokens can be configured to expire in as little as one hour or as long as ten years. These customizations enable Amazon Cognito customers to balance the security and usability of each application they develop.

What happens when Cognito token expires?

If the refresh token is expired, your app user must re-authenticate by signing in again to your user pool. If the minimum for the access token and ID token is set to 5 minutes, and you are using the SDK, the refresh token will be continually used to retrieve new access and ID tokens.


2 Answers

As of August 12,2020, AWS has announced that user pools now supports customization of token expiration. Here are the steps to follow:

  1. Open your AWS Cognito console.
  2. Go to General Settings.
  3. Scroll down to App clients and click edit.
  4. Click on Show Details button to see the customization options like below: Token Expiry Customization Screen

Access token expiration must be between 5 minutes and 1 day. Cannot be greater than refresh token expiration.

For further detail on AWS cognito you can follow this link.

like image 147
Haziq Avatar answered Sep 17 '22 21:09

Haziq


This is currently not possible to configure for your user pool. They are set to one hour for everyone.

Edit: see Mike's comment, this has recently been added.

like image 40
Jeff Bailey Avatar answered Sep 18 '22 21:09

Jeff Bailey