Postman中实现:curl 中的-u--user username:password (Basic authentication scheme)

Postman中实现:curl 中的-u--user username:password (Basic authentication scheme),第1张

Postman中实现:curl 中的-u/--user username:password (Basic authentication scheme)

文章目录
      • # 在Postman中实现Basic authentication
      • 方法一:最简单方法
      • 方法二:其他方法


username:password这种身份验证形式使用的是http authentication 中的basic形式;具体说明参考这个超链接:https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication

# 在Postman中实现Basic authentication

以访问elasticsearch为例:curl “http://127.0.0.1:9200/_cat/indices” --user elastic:testpwd

方法一:最简单方法

方法二:其他方法
  1. 将username:secret进行base64加密得到 dXNlcm5hbWU6c2VjcmV3, 然后前面加上一个Basic和空格,构造一个字符串形如: Basic dXNlcm5hbWU6c2VjcmV3。
  2. 然后添加到postman的header中Authorization作为键,该字符串为值。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/zaji/5679422.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存