javascript - 无法从 JavaScript 客户端访问 Thinktecture IdentityServer3 上的登录

标签 javascript thinktecture-ident-server

我几乎按照使用 mvc 客户端的教程构建了一个 IdentityServer。 http://identityserver.github.io/Documentation/docs/overview/simplestOAuth.html IdentityServer 与 mvc 客户端一起工作正常,但我使用的是 javascript 客户端,所以我下载了 javascript 示例:Javscript Implicit Client: https://github.com/IdentityServer/IdentityServer3.Samples/tree/master/source/Clients/JavaScriptImplicitClient

当我尝试从客户端登录时,它总是返回“ 客户端应用程序未知或未经授权。”

有人能指出我正确的方向吗?有没有办法打开日志记录以查看客户端被拒绝的原因?

相关javascript代码:

 var config = {
        authority: "https://localhost:44302/identity",
        client_id: "mws",
        redirect_uri: window.location.protocol + "//" + window.location.host + "/index.html",
        post_logout_redirect_uri: window.location.protocol + "//" + window.location.host + "/index.html",

        // these two will be done dynamically from the buttons clicked
        //response_type: "id_token token",
        //scope: "openid profile email read write",

        // we're not using these in this sample
        silent_redirect_uri: window.location.protocol + "//" + window.location.host + "/silent_renew.html",
        //silent_renew: true,

        // this will allow all the OIDC protocol claims to vbe visible in the window. normally a client app 
        // wouldn't care about them or want them taking up space
        filter_protocol_claims: false
    };

服务端客户端定义:

new Client
            {
                Enabled = true,
                ClientName = "Manager Workstation",
                ClientId = "mws",
                Flow = Flows.Hybrid,
                RequireConsent = true,
                RedirectUris = new List<string>
                {
                    "https://localhost:44303/index.html"
                },      
                PostLogoutRedirectUris = new List<string>
                {
                    "https://localhost:44303/index.html"
                }
            }, ...

最佳答案

我让它工作了。问题出在具有“Flow = Flows.Hybrid”的服务端,它应该是“Flow = Flows.Implicit”

关于javascript - 无法从 JavaScript 客户端访问 Thinktecture IdentityServer3 上的登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30375415/

相关文章:

javascript - 如何创建云图?

javascript - jQuery RTF 编辑器

javascript - 在固定定位元素中显示所有内容

asp.net - 如何使用 IdentityServer v3 保护 IdentityManager

c# - OAuth 2.0 不适用于本地 IIS

c# - 身份服务器 4 : adding claims to access token

javascript - 在 header 中传递 openid-connect oauth2 承载 token

javascript - 如何修复语法错误: await is only valid in async function in Google cloud vision

javascript - 为什么 'active' 类没有分配给内容列表项?

adfs - 联合身份验证后,重定向到最初请求的 url