【问题标题】:In Apigee, how to pass access_token to GetOAuthv2Info policy?在 Apigee 中,如何将 access_token 传递给 GetOAuthv2Info 策略?
【发布时间】:2014-03-14 02:47:02
【问题描述】:

我正在尝试使用 Apigee 的 GetOAuthv2Info 政策,但我认为我遗漏了一些非常简单的东西(对于 Apigee/API 来说仍然是新的)...

根据示例配置策略:

<GetOAuthV2Info name="GetTokenAttributes">
  <AccessToken>request.queryParam.access_token</AccessToken>
</GetOAuthV2Info>`

如果我尝试通过查询参数传递有效令牌:

http://{host}/path/to/endpoint?access_token=tUbvXzh97UtRRUuBpGUNpXESJtD1,我收到 404 Not Found 错误代码:

{"fault":"{\"detail\":
{\"errorcode\":\"keymanagement.service.invalid_access_token\"},
\"faultstring\":\"Invalid Access Token\"}"}

这是将访问令牌传递给策略的正确方法吗?

提前致谢!

【问题讨论】:

    标签: oauth-2.0 apigee


    【解决方案1】:

    试试:

    <GetOAuthV2Info name="GetTokenAttributes">
      <AccessToken ref="request.queryparam.access_token"></AccessToken>
    </GetOAuthV2Info>
    

    <GetOAuthV2Info name="GetTokenAttributes">
      <AccessToken>{request.queryparam.access_token}</AccessToken>
    </GetOAuthV2Info>
    

    您的原始策略可能是使用 request.queryParam.access_token 的文字字符串值作为令牌引用。还注意到queryparam 完全小写。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-10
      • 2019-03-05
      • 1970-01-01
      • 2019-08-06
      • 2022-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多