azuremsal-angular在Angular 6中登录成功后没有重定向到主页组件。

问题描述 投票:0回答:1

我使用的是msal-angular(1.0.0)和msal(^1.3.0)。登录成功后,页面是空的,没有重定向到主页。但当我刷新页面时,它显示的是主页内容。

我按照这个来做。https:/[email protected]

在我的应用程序中,当登录成功时,用户应该被重定向到主页。

{ path: 'home', component: HomeComponent, canActivate : [MsalGuard] },
{ path: 'profile', component: ProfileComponent, },
{ path: '',
redirectTo: 'home',
pathMatch: 'full'
} 

我试过用@azuremsal-angular - 0.1.4也试过如何不刷新重定向到主页?

azure-active-directory angular6 msal
1个回答
1
投票

下面是一个Angular与Azure admsal的例子。https:/github.comAzure-Samplesactive-directory-javascript-singlepageapp-angularblob6ea2a37027c787bd19b8b57a58cbb1c46a5a6ef0srcappapp-routing.module.ts。

我直接链接到了路由页面,它和sruthi说的一模一样,但是登录成功后应该会把你带到你点击登录之前试图到达的地方,根据sruthis的路由,如果你是在站点根目录,它应该会把你重定向到主页。

在你上面的代码中,路由是不正确的,为什么你要确保主页而不是配置文件? 另外,根据你的代码中的路由设置,当你加载页面时,你会被撞到登录页面,以及homecomponent。

© www.soinside.com 2019 - 2024. All rights reserved.