Issue
I've created a new app and I want to use Auth0 for login.
My question is how I can redirect automatically to auth0 login if I'm not logged in yet (without using the Login button from their example)?
I have tried to inject auth service in app.module and verify if I'm logged in, but it fails because I've entered into an infinite loop.
I think that I have to wait somehow for auth0 to read from storage and only after this to verify if I'm logged in or not.
Solution
I work with the Auth0 Community and I wanted to reach out and share with you a very recently updated Auth0 Angular Quickstart that can be fantastic to check against your application to make sure everything is setup as we would recommend.
To answer your specific question, I would leverage the handleAuthCallback()
to check to see if the necessary query parameters (code and state) are present. If they aren't there you can then force a login.
https://auth0.com/docs/quickstart/spa/angular2/01-login
Answered By - Coding Morrison
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.