且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Gitlab API:如何生成私有令牌

更新时间:2023-02-07 13:32:15

问题在于 data-urlencode CURL 选项.由于它是 HTTP POST,您不需要对数据进行 URL 编码,实际上是将 & 编码为 & 并导致您的问题.而是使用 --data 选项.

The problem is the data-urlencode CURL option. Since it's an HTTP POST you don't need to URL encode the data, and is actually encoding the & into & and causing your issue. Instead use the --data option.

curl http://git.ep.petrobras.com.br/api/v3/session --data 'login=myUser&password=myPass'

此外,请小心通过纯 HTTP 发送凭据.它很容易被嗅到.

Also, be careful sending credentials over plain HTTP. It could be easily sniffed.