2017-03-07 36 views
0

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

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

+0

是的,好像你缺少授权类型。它通常是'password'或'refresh_token',但它取决于API文档。 – Coder

回答

0

本文档是正确的。以下是生成令牌和撤销令牌的示例命令。

卷曲-k -d “grant_type = client_credentials” -H “授权:基本 dkFGR0pLQWliMDVrUW5fX2JJZFgzS1pEaGZvYTo2NDFGWlNtSVJ2anVIU0ozcTYzbHVENXU0Mllh” http://localhost:8280/token

卷曲-k -v -d “标记= 77ed4636c08c80fefb6f7aa1ce6987e0” -H “授权:基本 dkFGR0pLQWliMDVrUW5fX2JJZFgzS1pEaGZvYTo2NDFGWlNtSVJ2anVIU0ozcTYzbHVENXU0Mllh” -H “内容类型:应用程序/ x WWW的形式进行了urlencoded” http://localhost:8280/token

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

+0

因此,在分布式环境中,API Mgr Store可以通过调用http:// [API Mgr Gateway]:PORT /撤销URL来撤消令牌。然后,网关将使用突触API通过URL http:// [Key Mgr]:PORT/oauth2/token调用密钥管理器。它是否正确? –

+0

你的部分解释是正确的。商店将在网关中调用撤销终点。如果您检查了作为撤销API的synapse中的_RevokeAPI_.xml,该调用将转到http:// [Key Mgr]:PORT/oauth2/revoke。为了撤销令牌,我们使用吊销端点。 – Pubci