asp.net-mvc - IdentityServer3 为授权端点返回 invalid_scope
问题描述
我在我的 ASP.NET MVC 网站上安装了 IdentityServer3 和一个定义如下的客户端(一个 NopCommerce 插件)(网址仅用于测试):
new Client
{
ClientName = "Deep Stores",
ClientId = "deepstores",
ClientSecrets = new List<Secret>
{
new Secret("0B0A3FD3-F30C-428C-B1A3-6E570103614D".Sha256())
},
AccessTokenType = AccessTokenType.Reference,
RedirectUris = new List<string>
{
"http://localhost:2030/plugins/ExternalAuthDeepStudies/logincallback"
},
Flow = Flows.AuthorizationCode,
AllowAccessToAllScopes = true,
AllowedScopes = StandardScopes.All.Select(x => x.Name).ToList()
}
当尝试使用如下所示的 url 获取授权令牌时,它第一次工作(出现登录并授予页面等等),但对于其余请求,它返回error=invalid_scope
给我的回调!
请求授权端点:
https://127.0.0.1/core/connect/authorize?client_id=deepstores&redirect_uri=http%3A%2F%2Flocalhost%3A2030%2Fplugins%2FExternalAuthDeepStudies%2Flogincallback&scope=profile&response_type=code
怎么了?为什么我会收到这个错误?
范围定义为:
public static IEnumerable<Scope> Get()
{
return new[]
{
StandardScopes.OpenId,
StandardScopes.Profile,
StandardScopes.Email,
StandardScopes.Address,
StandardScopes.Phone,
StandardScopes.OfflineAccess,
StandardScopes.RolesAlwaysInclude,
StandardScopes.AllClaims,
};
}
请注意,我使用 EntityFramework 并且我所有的员工都存储在数据库中。另外,我使用 ASP.NET Identity 来管理用户和角色。
解决方案
推荐阅读
- c# - 部署 ASP.NET 4.5 MVC 时未将对象引用设置为对象的实例
- zapier - “运行 Python”模块给出错误:'str' 对象没有属性 'copy'
- java - 如何使用 id 在组中添加菜单?
- mongodb - 选择数组的所有对象都具有某些值的文档
- php - PHP password_hash 和 password_verify 奇怪的问题没有验证
- android-studio - 我如何使 android studio 代码不是一行
- python - 在不关闭 Flask 服务器的情况下运行多个功能
- c - Clang 参数 -Wno-conditional-type-mismatch 和 GCC
- html - Rails Ransack 没有正确过滤但对象状态?
- python - 可以调整 Ardunio 代码以从 Spyder(或其他 Python IDE)运行吗?