如何在 Angular 4 中实现 OpenID

How to implement OpenID in Angular 4

我正在使用 Angular 4 构建一个我想与 Steam 集成的应用程序。

我目前正在努力研究 openID 以及如何使用它来获取用户的 64 位 Steam ID。这很糟糕。我在 openID 的网站上找到了 TypeScript 库并将其安装到我的应用程序,但 Steam 说我需要将 http://steamcommunity.com/openid 设置为提供者。

彻底查看了 Angular 4 OpenID 库的文档后,我在任何地方都找不到 "provider" D:

话又说回来,我什至不确定我使用的是正确的库! (OpenID 提到 "obsolete specifications such as OpenID 2",我很确定这是 Steam 使用的)

我该如何处理?或者是否有更简单的 API 使用 OpenID 访问 steam?

编辑

这是配置代码,我意识到我不再理解我在做什么:

export class AppModule {
constructor(public oidcSecurityService: OidcSecurityService) {

    let openIDImplicitFlowConfiguration = new OpenIDImplicitFlowConfiguration();
    openIDImplicitFlowConfiguration.stsServer = 'https://localhost:44318';
    openIDImplicitFlowConfiguration.redirect_url = 'https://localhost:44311';
    openIDImplicitFlowConfiguration.client_id = 'angularclient';
    openIDImplicitFlowConfiguration.response_type = 'id_token token';
    openIDImplicitFlowConfiguration.scope = 'openid email profile';
    openIDImplicitFlowConfiguration.post_logout_redirect_uri = 'https://localhost:44311/Unauthorized';
    openIDImplicitFlowConfiguration.startup_route = '/home';
    openIDImplicitFlowConfiguration.forbidden_route = '/Forbidden';
    openIDImplicitFlowConfiguration.unauthorized_route = '/Unauthorized';
    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:44386/wellknownconfiguration.json';
    // openIDImplicitFlowConfiguration.storage = localStorage;

    this.oidcSecurityService.setupModule(openIDImplicitFlowConfiguration);
}

您甚至没有将代码放入正确的文件中或反对正确的 class app.component.ts i.e. AppComponent 应该包含那些东西。

您应该下载 zip or better still use Git and check it out from https://github.com/manfredsteyer/angular2-oauth-oidc-demo.git