使用带有客户端凭证流的 OAuth2 插件在 Kong 中使用一个令牌访问多个 API

Access multiple API's with one token in Kong using the OAuth2 plugin with Client Credentials flow

使用 Kong API 网关,我已将 OAuth2 插件添加到所有 API,希望获得一个令牌来访问这些 API。

当我用必填字段调用:www.example.com/oauth2/token时: grant typeclient idclient secret

它迫使我添加 API:www.example。com/apiendpoint/oauth2/token

很遗憾,生成的令牌只能访问特定的 API。

我试过:

www.example.com/apis/oauth2/token
www.example.com/token  

以及查看最新的 API Dos: https://getkong.org/docs/0.10.x/admin-api/ none 其中有效。

是否可以生成一个令牌来访问所有 API,如果是的话如何?

今天 Kong 无法做到这一点 - 欢迎您提出问题 https://github.com/Mashape/kong/issues 以提高您的请求在 Kong 社区中的可见度。

对于搜索如何执行此操作的人。

一种实现所要求的方法是在管理员 API:

上执行 post
$ curl -X POST http://kong:8001/oauth2_tokens \
    --data "api_id=API-ID" \
    --data "scope=SOME-SCOPE" \
    --data "credential_id=KONG-APPLICATION-ID" \
    --data "token_type=bearer" \
    --data "access_token=SOME-TOKEN" \
    --data "refresh_token=SOME-TOKEN" \
    --data "expires_in=3600"

通过这种方式,您可以在所需的 API 中设置令牌。

KONG-APPLICATION-ID可以在/consumers/consumername/oauth2API点找到