Redirect to my application after user login (Frontegg Hosted)
If you are using Frontegg Hosted Login and followed one of the client-side frameworks Hosted login guides. You will most likely be using loginWithRedirectfunction
or a hook redirecting the user either to your Hosted login / sign-up / your application if there is already an existing session for the user in that browser.
In the process of redirecting from your application URL to the Frontegg Hosted login or sign-up, the original URL is saved in the browser to redirect the user back— after authentication with Frontegg.
To implement CTA buttons and similar functionalities using Frontegg's hosted login or sign-up, you will need to pass redirectUrl
as a query param on the link for Hosted login or sign-up, as in the below examples:
https://[your-frontegg-subdomain]/oauth/account/sign-up?redirectUrl=[your-application-url]
https://[your-frontegg-subdomain]/oauth/account/sign-up?redirectUrl=http://localhost:3000
When passing the redirectUrl
- the user will be redirected back to this URL after authentication. Not passing a redirectUrl
will result in the user being stuck on an /Oauth
blank screen after authentication.
Updated 7 months ago