[英]How to assemble preemptive auth in curl command , while using POST method
我需要对REST API使用POST方法。当我选择“ Preemptive Authentication”时,它在SOAP UI中运行良好,我需要在Curl中组装此身份验证选项。
在Web服务上,没有设置抢占属性。 它只有带有用户名和密码的基本身份验证系统。
我试过了--anyauth,它不起作用。 我有以下命令。
curl -X POST -H "content-type:application/json" --verbose -u username:password http://example.net:1234/api/Flows/UpdateStatus -d '{"EventId": "123","Status": "success"}'
我总是在错误之下。
{"Message":"Authorization has been denied for this request."}
我尝试在标头部分提供base64编码的用户名和密码值,而不是在user部分下提供用户名和密码,它为我工作了。
curl -X POST -H "content-type:application/json" --verbose -H "Authorization: Basic Base64_encoded_value_of_user_&_password" http://example.net:1234/api/Flows/UpdateStatus -d '{"EventId": "123","Status": "success"}'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.