我几乎按照使用 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/