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
方法一:最简单方法
方法二:其他方法
- 将
username:secret
进行base64
加密得到 dXNlcm5hbWU6c2VjcmV3, 然后前面加上一个Basic
和空格
,构造一个字符串形如: Basic dXNlcm5hbWU6c2VjcmV3。 - 然后添加到
postman
的header
中Authorization
作为键,该字符串为值。