Logout from an ALB session that is authenticated by Cognito

1

Hello!
I'm failing with logging out from a Cognito authenticated ALB session. The authentication itself works perfectly.
I want to logout the user from the session and understand I have to delete/expire the cookie (AWSELBAuthSessionCookie-0,...) and redirect to the /logout endpoint. I also understand that the auth session cookie is HttpOnly and must be deleted server-side.
The authenticated application is hosted on a subdomain "a.example.com". My various server-side cookie deletion attempts failed. I had for example the following response header set:

"set-cookie: AWSELBAuthSessionCookie-0=;Domain=a.example.com;Path=/;Max-Age=0;Secure"

But none of my set-cookie headers did actually delete the auth session cookie.
Any ideas how the cookie can be deleted/expired?
Cheers Fabian

질문됨 5년 전1855회 조회
1개 답변
0

What did the trick is omitting the domain (although in my case the authentication was setup for a hostname with a subdomain).
This worked for me:

Set-Cookie "AWSELBAuthSessionCookie-0=deleted;path=/;expires=Thu, 01 Jan 1970 00:00:00 GMT;"
답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠