Amazon Cognito user pool LOGOUT endpoint is not working as expected

0

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

It says the only required request parameter for logout endpoint is client_id

But when I call the logout endpoint with my client_id it is throwing an error Required String parameter 'redirect_uri' is not present (screenshot https://drive.google.com/file/d/1i14NI6s-ygzvyNWYprURn6wqZD8IMO6I/view?usp=sharing)

This is the URL I used for logout https://<mydomain>.auth.us-east-1.amazoncognito.com/logout?client_id=<my app client id> (I just redirected my web application to this URL for logout)

已提问 2 年前7679 查看次数
2 回答
1
已接受的回答

When logging out of Cognito, I have had success using the following format:

https://<your-cognito-domain>/logout?client_id=<your-app-client-id>&logout_uri=<url-for-your-logged-out-page>

In your Cognito User Pool, under the App Client settings, you will need to add the URL for your logged-out page in the "Sign out URLs" text box.

You can have your loggedout.html page redirect users to a different page if needed.

AWS
已回答 2 年前
0

Don't forget to urlencode "logout_uri" in a GET call if your framework isn't doing it for you (for example when testing from a browser manually).

For sending to https://locahost/ for example I did the following:

https://blrefactor.auth.us-east-1.amazoncognito.com/logout?logout_uri=https%3A%2F%2Flocalhost&client_id=xxxx

Also, adding to the current answer for clarity. The docs say EITHER: logout_uri OR redirect_uri are required. doc link

Logout_uri is used when sending back to a static logout page. redirect_uri is used to redirect to a page that can request login and maintain state. In that case things like "response_type" are also required.

已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则