"--user"对curl意味着什么 [英] What does '--user' mean with curl

查看:1509
本文介绍了"--user"对curl意味着什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用API​​,因此必须发送POST请求.我知道如何设置标题(-H),而(-d)是正文,但是什么是"--user".

I'm working with an API and I have to send a POST request. I know how to set a header (-H) and (-d) is the body, but what is "--user".

如果我使用Postman提交此文件,或者使用axios或仅使用常规XMLRequest的文本编辑器提交此文件,该在哪里添加?

If I submit this with Postman, or in a text editor with axios or just regular XMLRequest, where do I add this?

文档说这是针对常规http身份验证的.

The docs say it is for regular http auth.

curl -X POST -H "Content-Type: application/json" \
     --user "<client_id>:<client_secret>" \
     -d '{"grant_type": "client_credentials", "scope": "public"}' \
     ...

curl中的

推荐答案

--user参数用于服务器身份验证.因此,如果您未通过--digest或--negotiate等其他参数定义身份验证类型,则表示Http基本身份验证的USER参数,也可以将它与:PASSWORD块组合以设置密码.您问题的完整答案取决于您向其发送请求的API背后使用的是哪种身份验证,而curl可能不足以支持它,因为它支持一组有限的身份验证方案...

--user parameter in curl used for server authentication. So if you don't define authentication type via other parameters like --digest or --negotiate, it means USER parameter for http basic authentication, it also could be combined with :PASSWORD chunk to set a password as well. The full answer on your question depends on what kind authentication is used behind API you are sending request to, and maybe curl would not be enough for it, as it support a limited set of authentication schemes ...

这篇关于"--user"对curl意味着什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆