zoukankan      html  css  js  c++  java
  • {"error":"invalid_scope"}的问题解决记录

            public static IEnumerable<IdentityResource> GetIdentityResources()
            {
                return new IdentityResource[]
                {
                    new IdentityResources.OpenId(),
                    new IdentityResources.Profile(),
                    new IdentityResource("sid","sid",new string[]{ "sid" }),
                    new IdentityResource("role","role",new string[]{ "role" }),
                    new IdentityResource("CommonAPI","CommonAPI",new string[]{ "CommonAPI" })
                };
            }

    下面是客户端:

                        Client oneResult = new Client
                        {
                            ClientId = client.ClientId,
                            ClientName = client.ClientName,
                            AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
                            ClientSecrets = { new Secret("123".Sha256()) },
                            AllowOfflineAccess = true,
                            RequireConsent = false,
                            RequireClientSecret = false,
                            AllowedScopes =
                            {
                                IdentityServerConstants.StandardScopes.OpenId,
                                IdentityServerConstants.StandardScopes.Profile,
                                IdentityServerConstants.StandardScopes.OfflineAccess,
                                "role",
                                "CommonAPI"
                            },
                            AuthorizationCodeLifetime = 36000,
                            IdentityTokenLifetime = 36000,
                            UserSsoLifetime = 36000
                        };
                        lstResult.Add(oneResult);

    客户端里如果有CommonAPI,但是上面的dentityResources里没有的话,就会报{"error":"invalid_scope"}

  • 相关阅读:
    Redis学习之(一)
    SpringMVC之学习(0)
    Node.js之Express三
    Node.js之Express二
    Node.js之Express一
    Node.js进程管理之进程集群
    Node.js进程管理之子进程
    Node.js其他模块
    Node.js进程管理之Process模块
    Node.js HTTP Server对象及GET、POST请求
  • 原文地址:https://www.cnblogs.com/wjx-blog/p/14764934.html
Copyright © 2011-2022 走看看