Curl wso2 API经理“;不支持的客户端身份验证方法&引用;

Curl wso2 API经理“;不支持的客户端身份验证方法&引用;,curl,oauth,wso2,wso2is,Curl,Oauth,Wso2,Wso2is,我正试图使用OAuth2 grant_type=password作为令牌请求,如WSO2 API管理器所述。使用下面的curl命令 curl -k -d "grant_type=password&username=<uname>&password=<pwd>&scope=PRODUCTION" http://localhost:8280/token 接下来,我提供消费者密钥,curl请求如下所示: curl -k -d "grant_type=p

我正试图使用OAuth2 grant_type=password作为令牌请求,如WSO2 API管理器所述。使用下面的curl命令

curl -k -d "grant_type=password&username=<uname>&password=<pwd>&scope=PRODUCTION" http://localhost:8280/token
接下来,我提供消费者密钥,curl请求如下所示:

curl -k -d "grant_type=password&username=<uname>&password=<pwd>&scope=PRODUCTION&client_id=<myconsumerkey>" http://localhost:8280/token
所以,我的问题是,API人员是否不支持这种grant_类型?或者,我在这里做错了什么吗?我是否应该查看此授权类型的identity server


干杯

您想在HTTP基本授权标头中发送客户端凭据(客户端密钥和密码)。Curl命令如下所示。这里使用--user-client-Key:client-Secret“使用curl命令创建基本授权头。您可以将以下命令用于您的值

curl--user tFVhXORF35S9TTyeaZIH2IEXEw4a:4h6fq4jgRYKrr4v91A_zQgw4Xtoa-k-d“grant_type=password&username=admin&password=admin”-H“内容类型:application/x-www-form-urlencoded”https://{IP}:{Port}/oauth2 token


此外,我猜WSO2API不支持在请求体中接收客户端凭据。根据OAuth 2.0规范,不建议使用。请检查

谢谢@Asela。在这种情况下,我没有客户机密钥或客户机机密。因此,我试图使用资源所有者密码授权来检索令牌。我想我见过的唯一替代方法是使用StoreAPI登录,然后检索密钥和密码,然后生成api令牌的请求。有什么想法吗?通常,当您使用资源所有者密码授权类型时,您还需要基本上对客户端进行身份验证,因为您是应用程序开发人员,必须注册应用程序并从API存储接收客户端凭据。
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!"}