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

编程入门 行业动态 更新时间:2024-10-27 22:25:57
本文介绍了如何在邮递员中传递客户凭证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这个卷发效果很好

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

在这种情况下, acme 和 acmesecret 是客户端凭据,应用程序使用它们来对在 localhost:9999

In this curl, acme and acmesecret are client credentials used by application to authenticate with authorization server running in localhost:9999

我正在尝试使用邮递员(Chrome的其余客户端)发出相同的请求.

I am trying to make the same request using postman (rest client for chrome).

这是屏幕截图(我在基本身份验证"标签中输入了凭据)

Here is the screen shot (I entered credentials in Basic Auth tab)

以下是发送的请求的预览:(注意:已添加自动化基本标头)

Here is the preview of the request that is sent out: (NOTE: AUthorization basic header is added)

我收到错误信息"invalid_client".该如何解决?

I am getting error as "invalid_client". how to fix this?

谢谢

推荐答案

cURL

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

acme:acmesecret 是在基本auth标头中发送的HTTP客户端凭据.您可以添加 -v 开关以查看请求中的标头.

The acme:acmesecret is the HTTP client credentials sent in the basic auth header. You can add the -v switch to see the headers in the request.

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

这是表单数据.

在邮递员"请求中,已将其切换.您在表单数据中有客户端凭据,而我猜您在auth标头中有用户凭据.

In the Postman request, you have it switched around. You have the client credentials in the form data, and I'm guessing you have the user credentials in the auth header.

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

Just switch them. For an OAuth 2.0 password grant request, the client credentials should go in the auth header, while the user credentials go in the form data.

更多推荐

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

本文发布于:2023-10-29 04:20:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538709.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:邮递员   凭证   客户   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!