【发布时间】:2019-08-01 15:23:36
【问题描述】:
我正在使用带有 Angular 客户端的 Identity Server 4。
我在两边都添加了相同的范围:
'openid profile offline_access email api'
但是我得到一个错误:
Sorry, there was an error : invalid_scope
Invalid scope
我检查了 Well-Known OpenID 配置,我看到了:
"scopes_supported": [
"openid",
"profile",
"api",
"offline_access"
]
所以邮件范围没有显示?
这可能是问题所在吗?为什么会这样?
我的 Identity Server 4 客户端定义是:
new Client {
ClientId = "spa",
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
RequireClientSecret = false,
AllowAccessTokensViaBrowser = true,
AllowOfflineAccess = true,
AllowedScopes = {
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
IdentityServerConstants.StandardScopes.OfflineAccess,
"api"
},
RedirectUris = new List<String> {
"https://localhost:5001",
"https://localhost:5001/index.html",
"https://localhost:5001/silent-refresh.html"
},
PostLogoutRedirectUris = new List<String> {
"https://localhost:5001/"
},
AllowedCorsOrigins = new List<String> {
"https://localhost:5001"
}
}
【问题讨论】:
标签: identityserver4