callback being called twice

my callback url is being called twice. the first time parsehash is giving me a proper authresult. the second time i am getting back a null authresult and a null error. but the bigger issue is why is the callback being called two times?

The most likely reason would be due to some logic in the client application that triggers the second request/navigation to that URL. In a flow where the Auth0 services performs an HTTP redirect to that callback anything that happens after the initial redirect should be under the influence of (caused by) the client application logic. You need to ensure that the client application does not have any logic that after processing the callback triggers another processing.

Ideally you should include minimal code snippets that reproduce the issue as otherwise it will be difficult to troubleshoot.

Hi @jmangelo , interestingly it only happens if i logout and them immediately attempt to login again. If i wait a bunch of seconds or more it works as expected.

This is the only place I am redirecting

@Injectable()
export class AuthActivate implements CanActivate {

    constructor(private authService: AuthService, private router: Router) {
    }

    canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
        if (!this.authService.isAuthenticated) {
            this.authService.login(state.url);
            return false;
        }

        return true;
    }

}


login(redirectUrl?: string): void {
    localStorage.setItem('redirect_url', redirectUrl || this.router.url);
    this.auth0.authorize();
}