Home  >  Q&A  >  body text

Single page application encounters custom login redirect issue in AWS Cognito

If I use the hosted UI in the app client on Cognito, the redirection works fine. However, if I create my own login page, it does not redirect to the website I want.

This is in a single page application using VueJS, I also tried using React. The login page works and logs the user in, however, I want it to automatically redirect to the redirect path I set in Cognito because that's what happens when using the hosted UI in Cognito. However, it does not redirect to the website and I cannot log in to the redirected website.

The hosting UI appears to handle all authorization and is able to pass the required credentials to where the redirect site can be logged in.

Maybe I just used it wrong? I need custom login and registration forms so I can't use the hosted UI. But I need the login to redirect to an external website and handle all the login credentials that the user will be authorized and logged in. Hope I explained this...

Any help would be greatly appreciated. Again, I'm very familiar with how this all works...thank you.

P粉323374878P粉323374878318 days ago547

reply all(1)I'll reply

  • P粉447785031

    P粉4477850312023-12-06 10:40:00

    When you use the hosted UI in Cognito, you are provided with an OAuth 2.0 compliant authorization server. If you don't use a managed UI, you'll have to build this functionality yourself along with the callback/redirect functionality for the Oauth flows (e.g. implicit, authorization code, etc.).

    Please note that the hosted UI can have custom fields and styles can be adjusted, please check here.

    reply
    0
  • Cancelreply