【问题标题】:Client is getting "Forbidden" on UserInfo endpoint客户端在 UserInfo 端点上得到“禁止”
【发布时间】:2021-01-04 12:01:12
【问题描述】:

所以我们已经设置了一个 IDP(IdentityServer4,Core2),并且一直将它用于我们自己的应用程序而没有问题(隐式流)。不过现在,我们的一个合作伙伴将使用我们的 IDP 从另一个应用程序发出 API 请求。

我们已经设置了 ApiResources:

new ApiResource("api", "API",
   new List<string>() {
      IdentityServerConstants.StandardScopes.OpenId,
      IdentityServerConstants.StandardScopes.Email,
      IdentityServerConstants.StandardScopes.Profile,
      "role",
       "team"
   })

有问题的客户:

new Client {
    ClientName= "ClientName",
    Description = "ClientDescription",
    LogoUri = "/img/ClientLogos/clientLogo.png",
    ClientUri = "https://client.url",
    RedirectUris = {
       "https://...",
       "https://...",
       "http://...",
       "http://..."
    },
    AllowedGrantTypes = GrantTypes.Code,
    RequireConsent = true,
    ClientId = "clientId",
    AllowedScopes = { "api" },
    ClientSecrets = { new Secret("clientSecret".Sha256()) },
    AlwaysSendClientClaims = true,
    AllowOfflineAccess = true,
    Claims = {
       ...
    }
}

我(错误地)假设由于客户端具有“api”范围,而该范围又具有“OpenID”和“Profile”范围,客户端将自动获得使用 UserInfo 端点的授权,但他们正在获得“禁止”状态码。 有人可以向我解释我们在这里做错了什么吗?

【问题讨论】:

    标签: oauth-2.0 identityserver4 openid-connect


    【解决方案1】:

    我认为您还需要包含 IdentityResources,因为它规定了 ID 令牌的哪些部分以及 UserInfo 端点提供的内容。

    【讨论】:

      猜你喜欢
      • 2021-09-02
      • 1970-01-01
      • 2015-12-09
      • 2020-09-24
      • 1970-01-01
      • 1970-01-01
      • 2018-05-09
      • 2021-09-05
      • 1970-01-01
      相关资源
      最近更新 更多