首页 新闻 赞助 找找看

IdentityServer4 遇到问题 "Scope email not found in store"

0
悬赏园豆:30 [已解决问题] 解决于 2022-11-23 12:30

使用 IdentityServer4 作为 gitlab 的 OAuth 2.0 provider,请求的 scope 中包含 email,IdentityServer4 报错 "Scope email not found in store",请问如何解决?

{
    "response_type":"code",
    "scope":"openid profile email"
}
dudu的主页 dudu | 高人七级 | 园豆:31075
提问于:2022-11-23 11:27

这个错误是在 DefaultResourceValidator.cs#L139 中记录的

dudu 1年前
< >
分享
最佳答案
0

通过源码 ResourceExtensions.cs#L83 找到了原因

public static ApiScope FindApiScope(this Resources resources, string name)
{
    var q = from scope in resources.ApiScopes
            where scope.Name == name
            select scope;
    return q.FirstOrDefault();
}

解决方法很简单,只需在 ApiScopes 表中添加 DisplayName 与 Name 为 email 的记录

dudu | 高人七级 |园豆:31075 | 2022-11-23 12:30
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册