【问题标题】:wso2 api manager 1.10 fails to regenerate tokenswso2 api manager 1.10 无法重新生成令牌
【发布时间】:2017-07-28 05:39:00
【问题描述】:

我下载并安装了 WSOAM 1.10 二进制文件,并按照步骤https://docs.wso2.com/display/CLUSTER44x/Clustering+API+Manager+1.10.0 进行分布式部署。在商店中进入“我的订阅”选项卡后,我无法为我订阅的 API 重新生成密钥并收到 HTTP 400 错误。 Key Mgr 日志显示:

TID: [-1234] [] [2017-03-07 20:26:14,730] ERROR {org.wso2.carbon.identity.oauth.endpoint.token.OAuth2TokenEndpoint} -  Error while creating the Carbon OAuth token request {org.wso2.carbon.identity.oauth.endpoint.token.OAuth2TokenEndpoint}
OAuthProblemException{error='invalid_request', description='Missing grant_type parameter value', uri='null', state='null', scope='null', redirectUri='null', responseStatus=0, parameters={}}
        at org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:59)
        at org.apache.oltu.oauth2.common.utils.OAuthUtils.handleOAuthProblemException(OAuthUtils.java:167)
...

I get the same if I use a curl command: 
curl -k -v -d "token=224cd22cd6b4ee622d951c69be34f633&grant_type=client_credentials" -H "Authorization: Basic eG9HSnZDS3FYNVNSazV6N3FHZXhhR3VTSWVnYTpzUTQ0QlBmTXRacG1ZNnA3ZUdPejhONVZxMGdh" -H "Content-Type: application/x-www-form-urlencoded" http:GATEWAY_HOST/revoke

看起来撤销 API 调用缺少“grant_type”参数。文档是否正确? :https://docs.wso2.com/display/AM1100/Token+API

【问题讨论】:

  • 是的,您似乎缺少授权类型。它通常是 passwordrefresh_token,但这取决于 API 文档。

标签: wso2 wso2-am


【解决方案1】:

这个文件是正确的。以下是生成令牌和撤销令牌的示例命令。

curl -k -d "grant_type=client_credentials" -H "授权:基本 dkFGR0pLQWliMDVrUW5fX2JJZFgzS1pEaGZvYTo2NDFGWlNtSVJ2anVIU0ozcTYzbHENXU0Mllh" http://localhost:8280/token

curl -k -v -d "token=77ed4636c08c80fefb6f7aa1ce6987e0" -H “授权:基本 dkFGR0pLQWliMDVrUW5fX2JJZFgzS1pEaGZvYTo2NDFGWlNtSVJ2anVIU0ozcTYzbHENXU0Mllh" -H "Content-Type: application/x-www-form-urlencoded" http://localhost:8280/token

根据堆栈跟踪,当您尝试撤销令牌时,调用会转到需要授权类型来生成令牌的令牌端点。请检查 synapse 中的默认 API (wso2am-1.10.0/repository/deployment/server/synapse-configs/default/api) 以验证端点是否正确。

【讨论】:

  • 因此在分布式环境中,API Mgr Store 可以通过调用 http://[API Mgr Gateway]:PORT/revoke URL 来撤销令牌。然后网关将使用突触 API 调用具有 URL http://[Key Mgr]:PORT/oauth2/token 的密钥管理器。这是正确的吗?
  • 你的部分解释是正确的。存储将调用网关中的撤销端点。如果您在 synapse 中检查 RevokeAPI.xml,它是 revoke API,调用将转到 http://[Key Mgr]:PORT/oauth2/revoke。为了撤销令牌,我们使用撤销端点。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多