The proper use of Cognito callback URL when opt not to use the Hosted UI

Viewed 828

Me and my team are currently working on utilizing AWS Cognito for user authentication. I am having some confusions with the use of callback URL and the Hosted UI. My first question is, if we opt not to use the Hosted UI (we have our own UI for signup/login), do we still need to setup the Callback URL? I have done plenty of research on this subject, and it seems to me based on the information I have seen that callback URL configuration is needed only when using the Hosted UI. I might be mistaken. So I need your help clarifying that.Thank you.

1 Answers

The callback URL is necessary for non-hosted UIs too. When you initiate authentication from the client you pass a callback url in the request, which is where Cognito will callback to with your token.

If the callback url in your client request does not match a callback url configured in your Cognito client, Cognito will simply refuse to respond with a token.

This is a good 'gotcha' when configuring Cognito, because if there is a small discrepancy/typo and the callback urls dont match, authentication will fail.

Related