CanActivate 路由适用于本地主机而不是服务器

CanActivate routing works on localhost not on server

我正在使用 auth0 进行身份验证。在我的 angular 应用程序中,我有一个 AuthGuard 以防止在使用 auth0 进行身份验证期间路由到 angular 应用程序。在身份验证期间,url 看起来像这样

     https://www.examplesite.com/#access_token=jlfdsfhWboAhvlRhbZt&expires_in=86400&id_token=aeryJ0eXAfsiOiJ..&token_type=Bearer&state=16d15855-0827-4189-bc34-26b981d578bb

该应用包含以下路线

export const ROUTES: Routes = [
 { path: '', loadChildren: './home/home.module#HomeModule', canActivate:    [AuthGuard] },
 { path: '**', redirectTo: '/' },
];

这是 AuthGuard:

@Injectable()
export class AuthGuard implements CanActivate {

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

   canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {

    if (route.fragment && route.fragment.startsWith('access_token')) {
        return false;
    }

    return true;
}
}

这在本地主机上工作正常。出现 AccessToken 路径并在其消失后应用程序加载成功。

但在已发布的服务器上不起作用。它显示了 accesstoken 路径,它消失了应用程序未加载。

在控制台中我收到这个警告 #access_token=rfsdf...&expires_in=86400&id_token=rfafsdf...&token_type=Bearer&state=72e39d8b-7907-4fbb-88fb-1dd690622541:7 键“”未被识别和忽略。

知道为什么这在本地主机上有效但在服务器上无效吗?

问题出在 Auth0 和处理哈希上。 https://github.com/auth0/lock/issues/527