Oauth 2.0 客户正在得到;“禁止”;关于UserInfo端点

Oauth 2.0 客户正在得到;“禁止”;关于UserInfo端点,oauth-2.0,identityserver4,openid-connect,Oauth 2.0,Identityserver4,Openid Connect,因此,我们已经建立了一个IDP(IdentityServer4,Core2),并将其用于我们自己的应用程序中,没有任何问题(隐式流)。不过现在,我们的一个合作伙伴将使用我们的IDP从另一个应用程序发出API请求 我们已经设置了ApiResources: new ApiResource("api", "API", new List<string>() { IdentityServerConstants.StandardScope

因此,我们已经建立了一个IDP(IdentityServer4,Core2),并将其用于我们自己的应用程序中,没有任何问题(隐式流)。不过现在,我们的一个合作伙伴将使用我们的IDP从另一个应用程序发出API请求

我们已经设置了ApiResources:

new ApiResource("api", "API",
   new List<string>() {
      IdentityServerConstants.StandardScopes.OpenId,
      IdentityServerConstants.StandardScopes.Email,
      IdentityServerConstants.StandardScopes.Profile,
      "role",
       "team"
   })
我(错误地)假设,由于客户端具有“api”作用域,而“api”作用域又具有“OpenID”和“Profile”作用域,因此客户端将自动获得使用UserInfo端点的授权,但他们获得了“禁止”状态码。
有人能解释一下我们这里做错了什么吗?

我认为您还需要包括IdentityResources,因为它规定了ID令牌的组成部分以及可以从UserInfo端点获得什么

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 = {
       ...
    }
}