I have a NextJS application that is using AWS Cognito for the User Authentication system. We are using AuthJS@5 to integrate with AWS Cognito. After clicking sign-in, the user gets redirected to AWS Managed Login page, where they will put their credentials and logs in, afterwards they will be redirected to our application and an authenticated session ID is now available for them independent of their AWS access/refresh tokens.
It works well!
But the annoying part is that when I log my user out from my application, it only logs them in my application. Their session or cookies are still logged in at the AWS Managed Login page. I have 2 concerns:
Attempt to solve
I tried deleting the cookie cognito
from my application once the user get's authenticated.
Because the AWS Cognito's cognito
cookie definition is as follows:
And by AWS docs:
A cognito session cookie that preserves successful sign-in attempts for an hour.
But this did not work.
So, is there a way to allow the following possible:
I hope anyone can help.
Thanks!
You can log the user out of their Cognito session by using the logout endpoint. You can redirect the user to this URL after logging them out of your app.