我如何通过授权头使用cURL?(可在/usr/bin/curl中执行)。


当前回答

这个例子包括以下内容:

POST请求 页眉内容类型 头授权 数据标志,JSON数据 Base64编码令牌 Ref-1:卷曲授权头 Ref-2: curl POST请求

curl -X POST -H "Content-Type: application/json" -d '{"name”:”Johnny B. Goode”, "email”:”johnny.b.goode@mail.com"}' -H "Authorization: Bearer $(echo -n  Guitar Maestro | base64)" https://url-address.com 

其他回答

对于那些做基于令牌的身份验证的人…一定要做到:

curl -H "AuthToken: "

相反! !

一个简单的例子是使用授权转换为base64的参数

curl -XPOST 'http://exemplo.com/webhooks?Authorization=Basic%20dGVzdDoxMjM0NTYK'

HTTP基本认证:

curl -H "Authorization: Basic <_your_token_>" http://www.example.com

替换_your_token_和URL。

这个例子包括以下内容:

POST请求 页眉内容类型 头授权 数据标志,JSON数据 Base64编码令牌 Ref-1:卷曲授权头 Ref-2: curl POST请求

curl -X POST -H "Content-Type: application/json" -d '{"name”:”Johnny B. Goode”, "email”:”johnny.b.goode@mail.com"}' -H "Authorization: Bearer $(echo -n  Guitar Maestro | base64)" https://url-address.com 

这招对我很管用:

curl -H "Authorization: Bearer xxxxxxxxxxxxxx" https://www.example.com/