Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Cognito AdminUserGlobalSignOut does not invalidate Cognito cookie?

I am using the web UI forms provided by Cognito for user sign in to our site with an OAuth flow.

We have a use case where the user should be signed out of all logged in session across browsers.

Looking at the docs, it seems like AdminUserGlobalSignOut does exactly what we're after. However, after calling it the 'cognito' browser cookie saved for foo.auth.us-east-1.amazoncognito.com remains valid. The next time a user loads https://foo.auth.us-east-1.amazoncognito.com/oauth2/authorize they are forwarded to the callback url as if they're authenticated instead of being redirected to foo.auth.us-east-1.amazoncognito.com/login.

I assume this is because the cookie is not invalidated by calling AdminUserGlobalSignOut, however this seems like the exact purpose of this method.

Is this a bug or am I missing something required to log a user out globally?

like image 817
plemarquand Avatar asked Jun 25 '18 18:06

plemarquand


People also ask

How do I invalidate a Cognito access token?

Revoke a token You can revoke a refresh token using the RevokeToken API operation. You can also use the aws cognito-idp revoke-token CLI command to revoke tokens. Finally, you can revoke tokens using the revocation endpoint. This endpoint is available after you add a domain to your user pool.

What does Cognito logout do?

The /logout endpoint signs the user out and redirects either to an authorized sign-out URL for your app client, or to the /login endpoint.

How do you refresh a Cognito ID token?

Initiate new refresh tokens (API)Pass REFRESH_TOKEN_AUTH for the AuthFlow parameter. The authorization parameter, AuthParameters , is a key-value map where the key is "REFRESH_TOKEN" and the value is the actual refresh token. Amazon Cognito returns new ID and access tokens after your API request passes all challenges.

Is Cognito case sensitive?

Cognito treats email addresses as case sensitive. If a user signs up with the email address [email protected], they cannot then sign in using [email protected].


1 Answers

I know it's kind of too late to answer, but I think this is due to the fact that Token and Cookie are independent of each other.

I think this is expected behavior because the AdminUserGlobalSignOut API is just a feature to revoke Refresh Token, not a feature to invalidate cookies issued by Cognito.

Also, as far as I know, there is no API to disable cookies issued by Cognito. I guess you have to use each Logout Endpoints.


Configuring a User Pool App Client - Amazon Cognito
https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-client-apps.html

Important

If you use Hosted UI and setup tokens less than an hour, the end user will be able to get new tokens based on their session cookie which is currently fixed at one hour.

AdminUserGlobalSignOut - Amazon Cognito Identity Provider
https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminUserGlobalSignOut.html

Signs out users from all devices, as an administrator. It also invalidates all refresh tokens issued to a user. The user's current access and Id tokens remain valid until their expiry. Access and Id tokens expire one hour after they are issued.

LOGOUT Endpoint - Amazon Cognito https://docs.aws.amazon.com/cognito/latest/developerguide/logout-endpoint.html

like image 115
noid11 Avatar answered Sep 24 '22 06:09

noid11