相关疑难解决方法(0)

将google idToken替换为本地openId令牌c#

我正在使用这个github项目https://github.com/openiddict/openiddict-core 这很棒.但是,当用户使用外部身份提供商时,我会被困在程序应该是什么,或者如何实现它们,对于这个例子,我将使用谷歌.

我有一个angular2 app运行,带有aspnet核心webAPI.我所有的本地登录工作connect/token都很完美,我使用用户名和密码调用,并返回accessToken.

现在我需要将谷歌作为外部身份提供商实施.我已按照此处的所有步骤实施Google登录按钮.这会在用户登录时打开一个弹出窗口.这是我为google按钮创建的代码.

// Angular hook that allows for interaction with elements inserted by the
// rendering of a view.
ngAfterViewInit() {
    // check if the google client id is in the pages meta tags
    if (document.querySelector("meta[name='google-signin-client_id']")) {
        // Converts the Google login button stub to an actual button.
        gapi.signin2.render(
            'google-login-button',
            {
                "onSuccess": this.onGoogleLoginSuccess,
                "scope": "profile",
                "theme": "dark"
            });
    }
}

onGoogleLoginSuccess(loggedInUser) {
    let idToken = loggedInUser.getAuthResponse().id_token;

    // here i can pass the …
Run Code Online (Sandbox Code Playgroud)

c# openid oauth asp.net-core openiddict

5
推荐指数
1
解决办法
1605
查看次数

标签 统计

asp.net-core ×1

c# ×1

oauth ×1

openid ×1

openiddict ×1