社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
Is there any possibility to get Personal Access Token for Gitlab API via command line rather than web interface? I'm working on some integration tests, and Gitlab deployment into the clean environment is a part of test session setup. After deployment test user is doing some work with Gitlab API. In order to access API, test user need to provide Personal Access Token.
I managed to dump traffic, and I see that token is provided within a rendered HTML template in response to POST request:
00:06:40.616996 IP6 localhost.amanda > localhost.53808: Flags [P.], seq 1:580, ack 1054, win 497, options [nop,nop,TS val 3133641719 ecr 3133641673], length 579
`..U.c.@................................'`.0...y.eIz.....k.....
........HTTP/1.1 302 Found
Server: nginx
Date: Tue, 21 Nov 2017 21:06:40 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 119
Connection: keep-alive
Cache-Control: no-cache
Location: http://localhost:10080/profile/personal_access_tokens
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Request-Id: 88178813-95ad-419a-b56b-5a5ddb183885
X-Runtime: 0.044209
X-Ua-Compatible: IE=edge
X-Xss-Protection: 1; mode=block
X-Accel-Buffering: no
Deep inside response:
However, it seems too be dirty to POST HTML Form and then parse resulting HTML in order to get the token. Can anyone share the secret how to do it right?
解决方案
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!