【问题标题】:wso2 API Manager "Unsupported Client Authentication Method!"wso2 API 管理器“不支持的客户端身份验证方法!”
【发布时间】:2014-01-18 01:36:13
【问题描述】:

我正在尝试将 OAuth2 grant_type=password 用于令牌请求,如 here 所述,使用 WSO2 API 管理器。使用以下 curl 命令。

curl -k -d "grant_type=password&username=<uname>&password=<pwd>&scope=PRODUCTION" http://localhost:8280/token

这个请求的响应是:

{"error":"invalid_request","error_description":"Missing parameters: client_id"}

接下来,我提供了我的消费者密钥,curl 请求变成了以下内容:

curl -k -d "grant_type=password&username=<uname>&password=<pwd>&scope=PRODUCTION&client_id=<myconsumerkey>" http://localhost:8280/token

然而,反应令人费解:

{"error":"unsupported_client_authentication_method","error_description":"Unsupported Client Authentication Method!"}

那么,我的问题是 API Man 不支持这个 grant_type 吗?或者,我在这里做错了什么?我应该查看此授权类型的身份服务器吗?

干杯

【问题讨论】:

    标签: curl oauth wso2 wso2is


    【解决方案1】:

    您希望在 HTTP 基本授权标头中发送客户端凭据(客户端密钥和机密)。卷曲命令将如下所示。此处“--user client-Key:client-Secret”已用于使用 curl 命令创建基本授权标头。您可以将以下命令与您的值一起使用。

    curl --user tFVhXORF35S9TTyeaZIH2IEXEw4a:4h6fq4jgRYKrr4v91A_zQgw4Xtoa -k -d "grant_type=password&username=admin&password=admin" -H "Content-Type: application/x-www-form-urlencoded" https://{IP}:{Port }/oauth2/令牌

    再补充一点,我猜 WSO2API 不支持在请求正文中接收客户端凭据。根据 OAuth 2.0 规范,不推荐。请查看here

    【讨论】:

    • 谢谢@Asela。在这种情况下,我没有客户端密钥或客户端密钥。因此,我试图使用资源所有者密码授权来检索令牌。我想我见过的唯一替代方法是使用 store api 登录,然后检索密钥和秘密,然后生成对 api 令牌的请求。有什么想法吗?
    • 一般情况下,当您使用资源所有者密码授权类型时,您还需要对客户端进行身份验证tools.ietf.org/html/rfc6749#section-4.3.2基本上,您是应用程序开发人员,您必须注册应用程序并从API接收客户端凭据商店。
    猜你喜欢
    • 1970-01-01
    • 2018-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-23
    • 2013-04-05
    • 2019-06-29
    • 2018-02-27
    相关资源
    最近更新 更多