WSO2AM REST API: 刷新应用程序订阅 accessToken

WSO2AM REST API: refresh application subscribtion accessToken

我的应用程序使用 Restful API.

与 WSO2AM 2.1.0 通信

现在我正在处理应用程序订阅部分,我需要创建一个能够刷新 accessToken 的功能,它是下面 json 中的 keys[0].token.accessToken

GET https://localhost:9443/api/am/store/v0.11/applications/896658a0-b4ee-4535-bbfa-806c894a4015
Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8

HTTP/1.1 200 OK
Content-Type: application/json

{
   "groupId": "",
   "callbackUrl": null,
   "subscriber": "admin",
   "throttlingTier": "Unlimited",
   "applicationId": "896658a0-b4ee-4535-bbfa-806c894a4015",
   "description": null,
   "status": "APPROVED",
   "name": "DefaultApplication",
   "keys": [   {
      "consumerKey": "AVoREWiB16kY_GTIzscl40GYYZQa",
      "consumerSecret": "KXQxmS8W3xDvvJH4AfR6xrhKIeIa",
      "keyState": "COMPLETED",
      "keyType": "PRODUCTION",
      "supportedGrantTypes": null,
      "token":       {
         "validityTime": 3600,
         "accessToken": "3887da6d111f0429c6dff47a46e87209",
         "tokenScopes":          [
            "am_application_scope",
            "default"
         ]
      }
   }]
}

我最终阅读了这份文档 https://docs.wso2.com/display/AM210/Token+API,但我认为这不是我要搜索的文档。那里的令牌API用于刷新WSO2的访问令牌,而不是用于刷新应用程序订阅令牌。

有什么办法吗?

Store API 使用客户端凭据授权类型生成访问令牌。这就是为什么您没有在响应中获得刷新令牌的原因。您可以执行以下操作。

使用了 API - https://docs.wso2.com/display/AM210/apidocs/store/

  1. 在 APIM 商店中创建一个应用程序。 (/应用程序)
  2. 通过生成密钥获取应用的consumerKey和consumer secret。 (/applications/generate-keys)

使用密码授予类型并生成令牌。 https://docs.wso2.com/display/AM210/Password+Grant