basic authorization command for curl

后端 未结 5 1908
小蘑菇
小蘑菇 2021-02-04 23:33

How do I set up the basic authorization using 64 encoded credentials ? I tried below the two commands but of no use , please suggest.

curl -i -H \'Accept:applic         


        
5条回答
  •  生来不讨喜
    2021-02-05 00:37

    How do I set up the basic authorization?

    All you need to do is use -u, --user USER[:PASSWORD]. Behind the scenes curl builds the Authorization header with base64 encoded credentials for you.

    Example:

    curl -u username:password -i -H 'Accept:application/json' http://example.com
    

提交回复
热议问题