我决定使用angular-auth-oidc-client项目完成工作,但是在安装软件包并进行导入后,在控制台中我已经
未处理的承诺拒绝:没有路由器的提供商!
我已经在app.module中导入了路由器,但是我将在另一个名为auth.component的组件中使用OpenID,该组件只有'标题'现在的东西。
这是 app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
// Import HttpClientModule from @angular/common/http
import {HttpClientModule} from '@angular/common/http';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { SearchComponent } from '../search/search.component';
import { AuthComponent } from '../auth/auth.component';
import { RouterModule, Routes } from '@angular/router';
// OpenID Connect
import { AuthModule, OidcSecurityService, OpenIDImplicitFlowConfiguration } from 'angular-auth-oidc-client';
@NgModule({
declarations: [
AppComponent,
SearchComponent,
AuthComponent
],
imports: [
BrowserModule,
HttpModule,
HttpClientModule,
RouterModule,
AuthModule.forRoot()
],
providers: [OidcSecurityService],
bootstrap: [AppComponent]
})
export class AppModule { constructor(public oidcSecurityService: OidcSecurityService) {
let openIDImplicitFlowConfiguration = new OpenIDImplicitFlowConfiguration();
openIDImplicitFlowConfiguration.stsServer = 'https://localhost:4200';
openIDImplicitFlowConfiguration.redirect_url = 'https://localhost:4200';
openIDImplicitFlowConfiguration.client_id = 'angularclient';
openIDImplicitFlowConfiguration.response_type = 'id_token token';
openIDImplicitFlowConfiguration.scope = 'openid email profile';
openIDImplicitFlowConfiguration.post_logout_redirect_uri = 'https://localhost:4200/Unauthorized';
openIDImplicitFlowConfiguration.start_checksession = false;
openIDImplicitFlowConfiguration.silent_renew = true;
openIDImplicitFlowConfiguration.silent_renew_offset_in_seconds = 0;
openIDImplicitFlowConfiguration.startup_route = '/home';
openIDImplicitFlowConfiguration.forbidden_route = '/Forbidden';
openIDImplicitFlowConfiguration.unauthorized_route = '/Unauthorized';
openIDImplicitFlowConfiguration.auto_userinfo = true;
openIDImplicitFlowConfiguration.log_console_warning_active = true;
openIDImplicitFlowConfiguration.log_console_debug_active = false;
openIDImplicitFlowConfiguration.max_id_token_iat_offset_allowed_in_seconds = 10;
openIDImplicitFlowConfiguration.override_well_known_configuration = false;
openIDImplicitFlowConfiguration.override_well_known_configuration_url = 'https://localhost:4200/wellknownconfiguration.json';
// openIDImplicitFlowConfiguration.storage = localStorage;
this.oidcSecurityService.setupModule(openIDImplicitFlowConfiguration);
}}
我在这里做错了吗?
我也对解决我的身份验证问题的任何新建议持开放态度,我没有偏好,我需要的是一种通过以下方式对用户进行身份验证的简单方法: Google,Mail.ru,Facebook和Vk.com
顺便说一句,我的后端是用PHP(Lumen)编写的