【问题标题】:HTTP Authentication equivalent for cURL username:passwordcURL 用户名:密码的 HTTP 身份验证等效项
【发布时间】:2017-06-06 19:48:58
【问题描述】:

有没有办法把下面的curl转换成正常的http请求?

curl --user <username>:<password> https://{username}.fred.sensetecnic.com/api/{custom_endpoint_name}

变成这样(使用 Postman 处理 http 请求)

GET https://{username}.fred.sensetecnic.com/api/{custom_endpoint_name}

Headers: Username: username, Password: password

【问题讨论】:

  • “正常的 http 请求”是什么意思?第二个 sn-p 看起来不像我见过的任何 http 请求。你读了吗:tools.ietf.org/html/rfc7617
  • 抱歉,如果代码括号让您感到困惑。这不是命令行代码。我的意思是有一种方法可以使用 Headers 而不是 curl 提供的 :

标签: http curl get postman


【解决方案1】:

使用邮递员提供的Basic Auth

  1. 转到Authorization 选项卡。
  2. 从类型下拉列表中选择Basic Auth
  3. 添加用户名和密码。
  4. 点击更新请求(如果适用)。


注意:为此,服务器必须接受 json 编码的凭据。

  1. 点击Headers
  2. 选择Content type
  3. 添加key-value 对、用户名和密码

【讨论】:

  • 什么反应
  • 未经授权:访问被拒绝
  • 在“授权”选项卡中尝试基本身份验证
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-07-11
  • 2018-07-13
  • 2017-07-31
  • 2011-07-04
  • 2015-01-17
  • 1970-01-01
  • 2011-01-24
相关资源
最近更新 更多