Gitlab API:如何生成私有令牌 [英] Gitlab API: How to generate the private token
本文介绍了Gitlab API:如何生成私有令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我试过的:
curl http://git.ep.petrobras.com.br/api/v3/session --data-urlencode 'login=myUser&password=myPass'
答案:
{"message":"401 Unauthorized"}
推荐答案
问题在于 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.
这篇关于Gitlab API:如何生成私有令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文