Single sign on 在angular中登录KeyClope后,我无法导航到仪表板页面
我得到以下错误 我添加了如下代码。此时会出现KeyClope登录屏幕。登录后无法重定向Single sign on 在angular中登录KeyClope后,我无法导航到仪表板页面,single-sign-on,angular7,keycloak,angular7-router,Single Sign On,Angular7,Keycloak,Angular7 Router,我得到以下错误 我添加了如下代码。此时会出现KeyClope登录屏幕。登录后无法重定向 const keycloak_config = config.keycloak; this.keycloakAuth = Keycloak(keycloak_config); this.keycloakAuth.redirectUri = environment.baseUrl + '/dashboard' ; this.keycloakAuth.init({onLoad: 'login-req
const keycloak_config = config.keycloak;
this.keycloakAuth = Keycloak(keycloak_config);
this.keycloakAuth.redirectUri = environment.baseUrl + '/dashboard' ;
this.keycloakAuth.init({onLoad: 'login-required',
checkLoginIframe: false})
.success(() => {
resolve();
})
.error(() => {
reject();
});
环境文件中的一个信息
baseUrl: 'http://localhost:4200'
app-routing.module.ts中的代码块。我完成了使用hash:false。因为如果useHash:true,则页面未打开。我就这样得到了错误
错误:无法匹配任何路由。URL段:“状态”错误:无法匹配任何路由。URL段:匿名函数处的“状态”(http://localhost:4200/vendor.js:82718:17)在CatchSubscriber.prototype.error处
const routes: Routes = [
{
path: '',
component: ContentLayoutComponent,
children: CONTENT_ROUTES,
canActivate: [AuthGuard]
},
{
path: 'login',
component: AuthLayoutComponent
}
];
@NgModule({
imports: [RouterModule.forRoot(routes, {useHash: false, scrollPositionRestoration: 'enabled'})],
exports: [RouterModule]
})
export class AppRoutingModule { }