What does '--user' mean with curl

后端 未结 4 1983
傲寒
傲寒 2020-12-29 19:15

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\".

If I submit this with Postm

4条回答
  •  旧巷少年郎
    2020-12-29 20:08

    Specify the user name and password to use for server authentication. If you simply specify the user name, curl will prompt for a password.

    If your curl request does not have any -- user, then server that requires authentication sends back a 401 response code and an associated WWW-Authenticate: header that lists all the authentication methods that the server supports.

    < HTTP/1.1 401 
    < WWW-Authenticate: Basic realm="oauth2/client"
    

    Then you will know the server is using Basic authentication

    You can add --basic to explicitly tell it is Basic authentication

    Please refer to HTTP authentication for more information

提交回复
热议问题