cognito hosted ui logout failing with

0

Hello
I have a test web application with cognito hosted UI. The login part works well and I can reach my index.html page after authenticating with cognito. when i try to logout following the documentation for cognito it just says
GET https://myDomain.auth.REGION.amazoncognito.com/logout?client_id=MyClientID&redirect_uri=https://www.cnn.com&response_type=code

when I do that, I get an error on chrome developer tools, that says
Access to XMLHttpRequest at 'https://myCognito.auth.REGION.amazoncognito.com/logout?client_id=MyClientID&redirect_uri=https%3A%2F%2Fwww.cnn.com&response_type=code' from origin 'https://myDomain.REGION.amazonaws.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
how do I make sure the browser wont stop the logout request? as I recall cognito does not have any place were to configure CORS

is there any other way to do a logout request?
thanks
RT

  • Not sure if you really want the user to navigate to CNN.com or it is just a sample, if you are trying on the domain where you have access, you can allow the requests from Cognito domain with "Access-Control-Allow-Origin".

rtt
demandé il y a 4 ans1406 vues
4 réponses
0

I just realized it is not a cognito issue. The browser receives a 302 status and a location but it is not redirecting. So cognito is doing its part, i just need to figure out the code to force the browser to redirect.

rtt
répondu il y a 4 ans
0

Your call to the Cognito /logout endpoint shouldn't be an XHR request -- the browser needs to be redirected to there. Cognito will then log the user out and redirect them back to the value you provided in redirect_uri.

jamess
répondu il y a 4 ans
0

Not sure if you really want the user to navigate to CNN.com or it is just a sample, if you are trying on the domain where you have access, you can allow the requests from Cognito domain with "Access-Control-Allow-Origin".

répondu il y a 2 ans
0

Hey @rtt how did you solve this? I am having the exact same redirect issue with a 302, and cors error.

AWS
répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions