Apigee不';t似乎不支持OAuth 2规范,有什么原因吗?

Apigee不';t似乎不支持OAuth 2规范,有什么原因吗?,oauth,apigee,Oauth,Apigee,我们正在使用Apigee的client\u凭证OAuth 2授权流请求承载令牌。根据报告: 如果我们打了一个电话,但我们得到了这样的错误: {"ErrorCode" : "invalid_request", "Error" :"Required param : grant_type"} 似乎使用Apigee我们必须发送grant\u type作为查询参数 为什么会这样?由于Apigee处理OAuth 2的方式,我们有Apigee的客户无法使用他们选择的语言中的OAuth库,最好知道是否有设计

我们正在使用Apigee的
client\u凭证
OAuth 2授权流请求承载令牌。根据报告:

如果我们打了一个电话,但我们得到了这样的错误:

{"ErrorCode" : "invalid_request", "Error" :"Required param : grant_type"}
似乎使用Apigee我们必须发送
grant\u type
作为查询参数

为什么会这样?由于Apigee处理OAuth 2的方式,我们有Apigee的客户无法使用他们选择的语言中的OAuth库,最好知道是否有设计


此外,它似乎不支持帖子正文中的
grant\u type
以及使用基本身份验证发送id和密钥。

结果表明,您不需要将
grant\u type
作为查询参数发送。GenerateAccessToken策略中有一个接受变量的
元素。例如,我可以使用以下内容:

<OAuthV2 name="GenerateAccessToken">
  <DisplayName>GenerateAccessToken</DisplayName>
  <FaultRules/>
  <Properties/>
  <!-- This policy generates an OAuth 2.0 access token using the password grant type -->
  <Operation>GenerateAccessToken</Operation>
  <!-- This is in millseconds -->
  <ExpiresIn>1800000</ExpiresIn>
  <Attributes/>
  <SupportedGrantTypes>
    <GrantType>password</GrantType>
  </SupportedGrantTypes>
  <GenerateResponse enabled="false">
   <Format>FORM_PARAM</Format>
  </GenerateResponse>
  <GrantType>user.grant_type</GrantType>
  <UserName>request.header.username</UserName>
  <PassWord>request.header.password</PassWord>
</OAuthV2>

GenerateAccessToken
GenerateAccessToken
1800000
密码
表格参数
user.grant\u类型
request.header.username
request.header.password

在本例中,
grant\u type
作为
user.grant\u type
传入。但是,
user.grant\u type
可以是任何内容——头、查询参数、表单参数,甚至是硬编码的值。这样,您(开发人员)就可以最大限度地灵活地发送
grant\u type

您可以粘贴您正在进行的确切API调用吗(显然您应该混淆密钥和机密)


我想理解你说“Apigee”时说的是什么——它可能意味着API BAAS()或使用API服务定义并附加OAuth 2策略的代理,或者其他什么?

Hi Greg,这是一个我们附加OAUthV2策略以生成访问令牌的代理。我现在正在研究这个策略,我认为@akoo1010可能是正确的,因为我们的策略中有:
request.queryparam.grant\u type
。我要试试他的建议,然后再发回来。谢谢
<OAuthV2 name="GenerateAccessToken">
  <DisplayName>GenerateAccessToken</DisplayName>
  <FaultRules/>
  <Properties/>
  <!-- This policy generates an OAuth 2.0 access token using the password grant type -->
  <Operation>GenerateAccessToken</Operation>
  <!-- This is in millseconds -->
  <ExpiresIn>1800000</ExpiresIn>
  <Attributes/>
  <SupportedGrantTypes>
    <GrantType>password</GrantType>
  </SupportedGrantTypes>
  <GenerateResponse enabled="false">
   <Format>FORM_PARAM</Format>
  </GenerateResponse>
  <GrantType>user.grant_type</GrantType>
  <UserName>request.header.username</UserName>
  <PassWord>request.header.password</PassWord>
</OAuthV2>