authService.loginWithPopup() works, authService.loginWithRedirect() does not. Anuglar 10

Hi,

Currently trying to retrofit an existing Angular 10 application with Auth0, but I’m experiencing inconsistent behavior with authService.isAuthenticated$ after successfully authenticating. When I use loginWithPopup() isAuthenticated$ works as expected, but when I use loginWithRedirect(), isAuthenticated$ always returns false – even with significant delay.

Is there any known difference between popup and redirect that would cause this? I’ve gotten the demo to work as expected, so it’s clearly something with how my existing app is configured, but I can’t find any discernible difference between the sample app and my existing app that would cause isAuthenticated$ to always return false after successfully authenticating via loginWithRedirect.

Thanks.

1 Like

I have exactly the same issue. Have you found any solution?

Are you using HashLocationStrategy in your app. This may be the issue?

provide: LocationStrategy, useClass: HashLocationStrategy

1 Like

Yep, that was my issue as well. Thanks!

1 Like

Teamwork makes the dreamwork! Thanks for sharing the solution!

Actually this solution is not suitable in my case. I am developing an Excel Add-in based on Angular. I am using officejs library which specifically requires hash based routing.

I’ve seen several articles where you are suggesting the usage of non-hash based routing for angular apps when loginWithRedirect is used. My impression is that even though is not advisory it is still possible. I am trying to do what is suggested in the following article Universal login and hash-based routing in angularjs app , but without any success.

Any suggestions?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.