How do AWS Cognito Authentication tokens refresh

matt

I am not understanding something about Amazon Cognito. If JWT tokens are only good for an hour, then they need to refresh, but how should my app do this? How does this happen? Do you just request new tokens and it remembers the session you are in? Also, do you store the JWT tokens in the state? I'm not understanding this, if anyone can help out I would appreciate it. Thanks!

qkhanhpro

When asking for token, if the grant_type is authorization_code the token endpoint returns refresh_token

Sample:

HTTP/1.1 200 OK
Content-Type: application/json

{
 "access_token":"eyJz9sdfsdfsdfsd",
 "refresh_token":"dn43ud8uj32nk2je",
 "id_token":"dmcxd329ujdmkemkd349r",
 "token_type":"Bearer", 
 "expires_in":3600
}

Then you can exchange the refresh token at the token endpoint to get another token

POST https://mydomain.auth.us-east-1.amazoncognito.com/oauth2/token >
Content-Type='application/x-www-form-urlencoded'
Authorization=Basic aSdxd892iujendek328uedj

grant_type=refresh_token&
client_id=djc98u3jiedmi283eu928&
refresh_token=REFRESH_TOKEN

Additional documentation can be found here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Serverless Framework How to Get Access, Id and Refresh Tokens from AWS Cognito

How to make Pre-authentication service of ID/Refresh Token of aws Cognito using VueJS

Are Cognito refresh tokens "valid" JSON web tokens?

AWS cognito - how to refresh token in angular?

How to ignore MFA Authentication in AWS Cognito

How to achieve certificate based authentication with AWS Cognito?

How to change claim values in refresh tokens and bearer authentication

AWS CLI - how to generate security tokens for a cognito user

Authentication with a password and access + refresh tokens

AWS Cognito js: init and authenticate CognitoUser using existing Refresh/Access/id Tokens and username

How do authentication tokens and authorization work in reactjs?

Authentication with Lambda and AWS Cognito

AWS Cognito Authentication in Reactjs

AWS Cognito HTTP authentication

AWS Cognito User Authentication

How to refresh token in AWS Cognito using Android SDK?

AWS Cognito force refresh session

AWS Cognito - Invalid Refresh Token

How to include TOTP MFA in AWS Cognito authentication process

Firebase authentication vs AWS Cognito

AWS Cognito authentication with Bearer token

Integrating AWS Cognito with API for authentication

Is AWS Cognito's generated Tokens URL safe?

Do Google refresh tokens expire?

Receiving Invalid Grant Type Error Received From AWS Cognito When Supply Auth Code : How do I get Id and access tokens for testing?

How to create Cognito IdentityPool with Cognito UserPool as one of the Authentication provider using aws cdk?

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

How would I get Tokens from AWS Cognito Api for machine to machine

AWS Cognito: tokens automatically get stored in local storage. How to save them in session storage instead?