Loop when authenticating with Angular 10 SPA Application

We have successfully integrated our Aungular 10 SPA Application with Auth0 following your quickstart guide. However, once in a while the authentication process enters in a loop. The loop prevents for showing the Universal Login Page when no user credentials are available an to enter in the application if user credentials are available from previous successful logins. The loop goes like this:

  1. The user types de domain to access or SPA, e.g. https://www.ourdomain.com
  2. The user is redirected to Auth0 for authentication, but the universal login is not displayed since the user is inmediately redirected to the Application again and the application redirects the user again to Auth0 since no authenticated user is present closing the loop.

We use the following code to get the user info which we think that may be causing this loop:

getUsersInfo(): Promise {
return new Promise((resolve, reject) => {
this.auth.isAuthenticated$.subscribe((authenticated) => {
this.appConfig.isLoggedIn = authenticated;
if (authenticated != true) {
this.auth.logout({ returnTo: environment.redirectUrl });

We believe that when the code checks authenticated the value of this variable is not properly set yet and always evaluates to false. We can introduce a delay before we perform this check but we were looking forward for a more robust and convenient solution. As I mention, this loop not always take place, just once or twice per day. We have also seen situations where the logs of Auth0 show continuos successful login operations during the loop, the information for a successful login is available from previous user sessions and Auth0 properly autenticates the user but is not capable of performing a timely communication of this successful login to our application and the application keeps looping.

Thanks in advance.