2017-03-07 35 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