AWS Cognito Custom Login Redirect Not working in Single Page Application

Viewed 876

If I use the Hosted UI in App Client on Cognito, the redirect works perfectly. However, if I create my own login pages, it doesn't redirect to the site I want.

This is in a Single Page Application using VueJS and I have also tried with React. The sign in page works, and it signs the user in, however, I expect that it will automatically redirect to the redirect path I have set in the Cognito as that is what happens when using the Hosted UI in Cognito. However, it doesn't redirect to that site and I am unable to login to the redirect site.

It appears that the Hosted UI handles all of the authorization and is able to pass the needed credentials to where it can login to the redirect site.

Perhaps I am just using this wrong? I need to have custom sign in and sign up forms, so I can't use the Hosted UI. But I need the Sign In to redirect to the external website and handle all of the login credentials where the user will be authorized and logged in. Hopefully I explained that ok...

Any help would be greatly appreciated. Again, I am well versed in how this all works... Thanks.

1 Answers

Once you use Hosted UI in Cognito, provides you an OAuth 2.0 compliant authorization server. If you don't use the hosted UI , you have to build this capability your self for the Oauth flows (ex - implicit, Authorization code etc) along with the callback/redirect functionality.

Just to note the hosted UI can have a custom domain and the styling can also be adjusted, please check here.

Related