Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to permanently log in users with aws cognito on app like Facebook app

I am developing an app to use aws cognito to manage my user authentication. The way I understand is, once authenticated, I will receive an access token and a refresh token. The access token is short-lived and I will have to use the refresh token to periodically get new ones. However, the problem I have is the refresh token also have an expiry date. What happen when the refresh token expires, do I ask users to log in again in the app? The Facebook app or the linkedin app seem to have users logged in permanently. Only a fresh re-install of the app would prompt users to log in again. One way I can think of is to keep the username and password saved in the app, but wouldn't that defeats the purpose of this token based authentication? So, what is a correct way to permanently log in users like Facebook app?

like image 926
crab oz Avatar asked Oct 16 '25 17:10

crab oz


1 Answers

AWS documentation says

By default, the refresh token expires 30 days after the user authenticates. When you create an app for your user pool, you can set the app’s Refresh token expiration (days) to any value between 1 and 3650.

Expiration 3650 means about 10 years what you can pretty much regard as " forever".

Details here http://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-with-identity-providers.html

like image 157
RastoStric Avatar answered Oct 18 '25 09:10

RastoStric



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!