Identity Server 4:为什么我收到未经授权的客户端? [英] Identity Server 4: Why i receive unauthorized_client?
本文介绍了Identity Server 4:为什么我收到未经授权的客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的MVC与标识服务器连接的初始设置。
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
AuthenticationType = "oidc",
SignInAsAuthenticationType = "Cookies",
Authority = "http://identity.azurewebsites.net",
RedirectUri = "http://localhost:62419/signin-oidc",
PostLogoutRedirectUri = "http://localhost:62419/signout-callback-oidc",
ClientId = "mvc",
ResponseType = "id_token",
Scope = "openid profile",
UseTokenLifetime = false,
RequireHttpsMetadata = false,
Notifications = new OpenIdConnectAuthenticationNotifications
{
SecurityTokenValidated = (context) =>
{
var identity = context.AuthenticationTicket.Identity;
var name = identity.Claims.FirstOrDefault(c => c.Type == identity.NameClaimType)?.Value;
return Task.FromResult(0);
}
}
});
我可以访问身份服务器。我收到一条消息
抱歉,出现错误:AUTHORIZED_CLIENT 无效的reDirect_uri
我已经将redirectUri添加到与上面显示的代码相匹配的ClientRedirectUris表中。是否还有其他我忘记添加或设置的区域。
推荐答案
此外,请确保您的作用域与客户端配置中的AloedScope匹配。如果我们能看到请求URL,那会很有帮助。即
https://identity.azurewebsites.net/connect/authorize?
client_id=mvc
&redirect_uri=http://localhost:62419/signin-oidc
&response_type=id_token
&scope=openid profile
&nonce=63653346343504
&state=CfDJAJDR
&response_mode=form_post
这篇关于Identity Server 4:为什么我收到未经授权的客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文