• {"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"}

  • 相关阅读:
    mysql-03
    mysql-02
    mysql-01
    RESTFUL设计风格
    mysql水平拆分和垂直拆分
    redis连环夺命问
    Python 的十大重要特性
    吊打--redis
    python2和3 的区别
    tornado第一段代码
  • 原文地址:https://www.cnblogs.com/wjx-blog/p/14764934.html
Copyright © 2020-2023  润新知