【发布时间】:2019-07-25 15:34:19
【问题描述】:
我遇到了这个错误,我在网上搜索了答案,几乎所有人都在谈论 requesturis,我仔细检查了以确保我的 uris 配置正确。我没有找到任何线索。任何想法。
Identity Server 4 设置:-
public static IEnumerable<Client> GetClients()
{
return new List<Client>()
{
new Client
{
ClientName="KtsWeb App",
ClientId="ktswebclient",
AllowedGrantTypes= GrantTypes.Hybrid,
AccessTokenType = AccessTokenType.Reference,
RedirectUris = new List<string>()
{
"https://localhost:44355/signin-oidc" //Client URL Address
},
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile
}
}
};
}
客户端设置:-
services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
}).AddCookie("Cookies",
(options) =>
{
options.AccessDeniedPath = "/Authorization/AccessDenied";
})
.AddOpenIdConnect("oidc", options =>
{
options.SignInScheme = "Cookies";
options.Authority = "https://localhost:44380"; //Identity Server URL Address
options.ClientId = "ktswebclient";
options.ResponseType = "code id_token";
options.Scope.Add("openid");
options.Scope.Add("profile");
options.SaveTokens = true;
});
【问题讨论】:
-
粘贴重定向发生的 url,我敢打赌你的重定向 uri 略有不同或不是 https 或类似的东西。
-
我没有明白你在说什么,但是定向 uri 是身份服务器主页/错误页面,它显示了错误消息。身份服务器可以使用自己的 uri 正常打开,但客户端会收到此错误。错误 uri:localhost:44380/home/error?errorId=
-
在 chrome 或类似的工具中打开开发者工具并检查用于连接/授权的网络请求
-
1.您创建了一个没有客户端密码的混合客户端。 2.您正在使用隐式客户端代码。选择一个。
标签: c# asp.net-mvc asp.net-core identityserver4