如何在邮递员中传递客户端凭据?

时间:2015-08-28 17:40:13

标签: curl rest-client postman

这种卷发效果很好

curl acme:acmesecret@localhost:9999/uaa/oauth/token  -d "password=password&username=user&grant_type=password" -H "Accept: application/json"

在此卷曲中,acmeacmesecret是应用程序用于在localhost:9999

中运行的授权服务器进行身份验证的客户端凭据

我正在尝试使用postman(Chrome的rest客户端)发出相同的请求。

这是屏幕截图(我在Basic Auth选项卡中输入了凭证)

enter image description here

以下是发出请求的预览:(注意:添加了AUthorization基本标头)

enter image description here

我收到错误" invalid_client"。如何解决这个问题?

由于

2 个答案:

答案 0 :(得分:3)

卷曲

acme:acmesecret@localhost:9999/uaa/oauth/token

acme:acmesecret是基本身份验证标头中发送的HTTP客户端凭据。您可以添加-v开关以查看请求中的标头。

-d "password=password&username=user&grant_type=password"

这是表单数据。

在Postman请求中,您可以切换它。您在表单数据中有客户端凭据,我猜您在auth标头中拥有用户凭据。

只需切换它们。对于OAuth 2.0密码授予请求,客户端凭据应该位于auth标头中,而用户凭据则包含在表单数据中。

答案 1 :(得分:0)

如果其他人需要更多说明,我发现这条信息对Postman文档很有帮助。

邮递员>发送API请求>授权

https://learning.getpostman.com/docs/postman/sending_api_requests/authorization/