IdentityServer4 版本:4.1.1.0
.Net Core3.1
client配置: new Client{
ClientId = "apiClientCode",
ClientSecrets = { new Secret("123456".Sha256()) },
AllowedGrantTypes = GrantTypes.Code,
RedirectUris = {"http://localhost:5003/auth/index"},//跳转登录到的客户端的地址
AllowedScopes = new List<string>
{
"secretapi"
}
}
控制台错误截图:
fail: IdentityServer4.Endpoints.AuthorizeEndpoint[0]
Request validation failed
info: IdentityServer4.Endpoints.AuthorizeEndpoint[0]
{
"ClientId": "apiClientCode",
"RedirectUri": "http://localhost:5003/auth/index",
"AllowedRedirectUris": [
"http://localhost:5003/auth/index"
],
"SubjectId": "anonymous",
"ResponseType": "code",
"ResponseMode": "query",
"GrantType": "authorization_code",
"RequestedScopes": "",
"PromptMode": "",
"Raw": {
"client_id": "apiClientCode",
"redirect_uri": "http://localhost:5003/auth/index",
"response_type": "code",
"scope": "secretapi"
}
}
1.AllowedScopes 增加:
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
2.redirect_uri 默认应该是 http://localhost:5003/signin-oidc。不清楚你是否重新配置了。
也这样试了试,跳转到登录页面,但是ReturnUrl跟的是一个指向Error页面的url,登录之后直接跳转错误页面
@我想啸天: 贴下你的客户端startup注册配置和identityserver 的client 配置
@gt1987: 问题已解决,配置问题
@我想啸天: 怎么解决的,说明一下,谢谢