1 Answer
- Newest
- Most votes
- Most comments
1
The issue you're experiencing with AWS Cognito logout not working properly on Safari for Google authentication is a known problem. This behavior is likely due to how Safari handles cookies and sessions differently from other browsers like Google Chrome.
To address this issue, you can try the following approach:
1. Before redirecting to the Cognito `/logout` endpoint, first call the `/oauth2/revoke` endpoint to revoke the user's access and refresh tokens. This step helps ensure that the tokens are invalidated on the server-side.
2. After revoking the tokens, then redirect the user to the Cognito `/logout` endpoint as usual.
3. Consider setting shorter expiration times for ID tokens (e.g., 5 minutes) to reduce the risk window if tokens are compromised.
4. Implement additional client-side logout logic in your application to clear any local storage or state that contains user information.
5. If possible, redirect users to the Google account logout page after the Cognito logout process to ensure they're fully signed out of their Google account as well.
It's important to note that the Cognito logout process primarily invalidates the user's tokens on the server-side, and client-side actions like clearing cookies may have limitations, especially in Safari's more restrictive environment.
If the issue persists, you may need to implement a custom logout flow that takes into account Safari's specific behavior with cookies and sessions. This might involve using browser-specific detection and applying different logout strategies based on the user's browser.
Keep in mind that while this approach can help mitigate the issue, it may not completely resolve it in all scenarios due to the complexities of cross-browser authentication and session management.
Sources
AWS Cognitio Logout Bug? | AWS re:Post
How to logout from ALB-Cognito which is EC2 instance running React | AWS re:Post
Relevant content
asked 6 years ago
asked 2 years ago
