gitlab访问令牌使用_如何从命令行获取GitLab个人访问令牌 - Go语言中文社区

gitlab访问令牌使用_如何从命令行获取GitLab个人访问令牌


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?

解决方案

版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/weixin_39726697/article/details/111863340
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2021-12-12 02:07:16
  • 阅读 ( 2287 )
  • 分类:

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢