pacman
pacman

Reputation: 93

AWS Cognito built-in UI error posting credentials when using response_type=code

I have spent a significant amount of time searching for a solution here and can't find one. Here is the situation:

I am actually a little surprised either one works because the documentation seems to indicate the /login endpoint is GET only: https://docs.aws.amazon.com/cognito/latest/developerguide/login-endpoint.html

I'd prefer to use the code response_type anyway. Am I doing something wrong here? Is anyone else having this issue? I don't think I'm doing anything unusual. It feels to me like something is just broken in the built-in ui flow. I have definitely discovered that I should not be using the built-in UI, but I'd like to get this working and then replace it if possible.

Please let me know if you need more information and I'd be happy to provide it.

EDIT: It actually does work if I make the redirect_url google.com, which means it's something with my app and the redirect, but there is basically no indication about what is wrong. Anyone know where I can find any kind of relevant logs or information related to these types of errors in Cognito?

Upvotes: 1

Views: 2428

Answers (1)

pacman
pacman

Reputation: 93

Alright this appears to be a bug in the built-in UI and I'll file it with Amazon. I finally figured out that my redirect_uri I was sending over had a trailing slash and the one I configured in Cognito did not have a trailing slash. It works when I remove this.

The reason I believe this is a bug is because normally when I pass in an invalid redirect, the UI immediately sends me to a page with that error. When the only difference is a trailing slash, I can go through the login flow fine, but it hits that 405 method not allowed error when trying to redirect back to my flow.

Not sure if anyone else will run into this very odd edge-case, but hopefully this is helpful if you do.

Upvotes: 5

Related Questions