Loging on landing page then redirect to SPA app

is it possible to have a landing page written in plain js with auth0 library and call auth0 login mechanism and then redirect to Angular SPA app?

I’am trying to do that but calling this.auth.isAuthenticated$ returns false. Am I doing something wrong or it is not possible to do that?

Hi @mbielawski,

Thanks for joining the Community!

Would you like to create your own custom login page using Universal Login? If so, you can create your own template by navigating to Branding > Universal Login. Select the Classic Login Experience, save and got to the Login custom template.

Or are you interested in implementing an embedded login? (note: embedded login would require a custom domain due to security considerations)

@ stephanie.chamblee

Hmm…I think that’s not what I meant. I want to be redirected from my landing page to auth0 login screen page, place all my credentials and then redirected to different page (maybe also different domain ie. locally) and being authenticated. Currently when my landing page is on http://localhost:63342/ by clicking on my site Login button I am redirected to auth0 login page which is fine. Then passing my credentials and being redirected to main application (Angular SPA http://localhost:4201/) calling this.auth.isAuthenticated$ from AuthService I got a response that I am not authenticated.

@stephanie.chamblee any news here?

Hi @mbielawski,

Just to clarify, is it a requirement that the landing page and app be on separate domains, or would it be two paths of the same domain (e.g. /landing and /app)?

@stephanie.chamblee I think it should work in both cases. Evenhough on production it can be same domain but locally it work on different ports (http://localhost:63342, http://localhost:4201) which make it different domains.

edit: Main app will be in sub domain

Thanks for the additional info! I will have to do a little bit of research on a cross-domain or using a sub-domain for the callback URL. If using the same domain, you should be able to use:

  appState: { target: '/some-url' }

But for cross-domain or using a sub-domain, I’ll have to do some more testing. SSO between Auth0 apps should not be a problem so the user should be logged into the other app/domain, but I’m not sure if the SDK will properly initiate the redirect in this case.