ellaisys / aws-cognito

AWS Cognito package (with MFA Feature) using the AWS SDK for PHP/Laravel
https://ellaisys.github.io/aws-cognito/
MIT License
110 stars 41 forks source link

Laravel Session/Cookie not respecting Cognito access token TTL #83

Closed sayajin101 closed 11 months ago

sayajin101 commented 11 months ago

Is your feature request related to a problem? Please describe. Laravel session cookie doesn't respect the JWT access token's expiry, unless I'm understanding/doing something wrong, because I would like the ability to be able to use the Cognito option to close all sessions (logout all devices) and once the JWT Token expires and tries to refresh the Laravel session gets logged out.

Describe the solution you'd like That the Laravel cookie gets adjusted to respect & use the same expiry for its cookie as the JWT

Describe alternatives you've considered No Idea

Additional context Laravel Cookie expires after 2 hours even with this package implemented, yet the Cognito JWT access token is set to expire in 5 minutes. image

Please maybe I'm not understanding everything correctly or am missing a crucial point in how this works, any help is appreciated.

amitdhongde commented 11 months ago

@sayajin101 Thank you for highlighting. You can set the SESSION_LIFETIME into the .env file. This value is in minutes to you can change it appropriately. Laravel would not easily allow to change the session timeout dynamically. Plan to look at that later. If the solution helps, let us know. we will update the documentation accordingly.

amitdhongde commented 11 months ago

Readme is updated in available in the master branch