GitLab import error due to improper use of access token (OD-1267)
xzheng opened 3 years ago

企业微信截图_16787861167737.png

1.要求填入的是 GitLab Personal Access Token。

3.png

2.再尝试多次无法成功后

3.通过工具抓包发现

2.png

4.是把个人的Access Token作为OAuth2 token来填写了。

5.gitlab的帮助文档中有如下说明:

OAuth2 tokens You can use an OAuth2 token to authenticate with the API by passing it in either the access_token parameter or the Authorization header. Example of using the OAuth2 token in a parameter: curl https://gitlab.example.com/api/v4/projects?access_token=OAUTH-TOKEN Example of using the OAuth2 token in a header: curl --header "Authorization: Bearer OAUTH-TOKEN" https://gitlab.example.com/api/v4/projects Read more about GitLab as an OAuth2 provider.

Personal access tokens You can use a personal access token to authenticate with the API by passing it in either the private_token parameter or the Private-Token header. Example of using the personal access token in a parameter: curl https://gitlab.example.com/api/v4/projects?private_token=<your_access_token> Example of using the personal access token in a header: curl --header "Private-Token: <your_access_token>" https://gitlab.example.com/api/v4/projects Read more about personal access tokens.

  • xzheng changed title 3 years ago
    Previous Value Current Value
    Gitlab按照提示导入失败,抓包看了下是头部的信息有误
    Gitlab按照提示导入工程,一直失败,报错没有权限,抓包看了下是头部的信息有误
  • Robin Shen changed title 3 years ago
    Previous Value Current Value
    Gitlab按照提示导入工程,一直失败,报错没有权限,抓包看了下是头部的信息有误
    GitLab import error due to access token error
  • Robin Shen commented 3 years ago

    Changed title to English so that it is understandable by all users.

  • Robin Shen changed title 3 years ago
    Previous Value Current Value
    GitLab import error due to access token error
    GitLab import error due to improper use of access token
  • Robin Shen commented 3 years ago

    @hopzheng 试了下可以连接到gitlab.com,也许你的gitlab版本太低?

  • OneDev changed state to 'Closed' 3 years ago
    Previous Value Current Value
    Open
    Closed
  • OneDev commented 3 years ago

    State changed as code fixing the issue is committed (561a2924)

  • xzheng commented 3 years ago

    感谢@robin,我查了下线上最新的文档,的确是有这个支持。我们这边的gitlab版本太低

  • OneDev changed state to 'Released' 3 years ago
    Previous Value Current Value
    Closed
    Released
  • OneDev commented 3 years ago

    State changed as build #3505 is successful

  • Robin Shen commented 3 years ago

    @hopzheng 为了兼容老版本,8.0.10 使用了 PRIVATE-TOKEN。

  • xzheng commented 3 years ago

    @robin 真是太给力了,我还在想怎么给项目组沟通升级呢,作者一下子就升级兼容了,真的非常感谢你的帮助。 我也会给周围的朋友们多多宣传你这个项目的。

  • Robin Shen commented 3 years ago

    @robin 真是太给力了,我还在想怎么给项目组沟通升级呢,作者一下子就升级兼容了,真的非常感谢你的帮助。 我也会给周围的朋友们多多宣传你这个项目的。

    感谢,🙏

  • xzheng commented 3 years ago

    @robin 我测试了最新版本的代码,发现没有改善,看了下源码,发现

    package io.onedev.server.plugin.imports.gitlab.ImportServer.java文件中

    第739行,isValid方法还是沿用原来的头部设置,导致校验这儿的方法还是走老路子

  • Robin Shen commented 3 years ago

    疏忽了,😓 在 8.0.11里改好了。

issue 1/1
Type
Bug
Priority
Normal
Assignee
Affected Versions
8.0.9
Issue Votes (0)
Watchers (4)
Reference
OD-1267
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover