1

如何向受 OAuth2 保护的 GitLab 页面发出 HTTPS 请求?

背景:GL 存储库从多个开发存储库中收集草稿文档,并在 GitLab 页面上发布。所有这些都受 OAuth2 保护。当我们接近发布日期时,我需要让更广泛的内部观众看到草案,我们不会为他们购买 GL 席位。公共文档服务器有一个预览 URL,受基本身份验证的轻微保护。我应该能够反向代理到 GitLab Pages 草稿——如果我只能让 GL 的 HTTPS 请求工作的话。

在授予每个角色的情况下使用curlwget和个人访问令牌 (PAT) (不,不是真的)进行测试。XYZXYZXYZXYZXYZXYZXY

❯ wget 'https://ourdev.gitlab.io/this/is/my/documentation?access_token=XYZXYZXYZXYZXYZXYZXY'
--2021-09-24 13:33:32--  https://ourdev.gitlab.io/this/is/my/documentation?access_token=XYZXYZXYZXYZXYZXYZXY
Resolving ourdev.gitlab.io (ourdev.gitlab.io)... 35.185.44.232
Connecting to ourdev.gitlab.io (ourdev.gitlab.io)|35.185.44.232|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://projects.gitlab.io/auth?domain=https://ourdev.gitlab.io&state=bCN5ylZVNsjKt33cFslzNw== [following]
--2021-09-24 13:33:33--  https://projects.gitlab.io/auth?domain=https://ourdev.gitlab.io&state=bCN5ylZVNsjKt33cFslzNw==
Resolving projects.gitlab.io (projects.gitlab.io)... 35.185.44.232
Connecting to projects.gitlab.io (projects.gitlab.io)|35.185.44.232|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://gitlab.com/oauth/authorize?client_id=5059a88907e1b093c23df47d996183b101a862a5e53e099b563120d1308db2c1&redirect_uri=https://projects.gitlab.io/auth&response_type=code&state=bCN5ylZVNsjKt33cFslzNw==&scope=api [following]
--2021-09-24 13:33:33--  https://gitlab.com/oauth/authorize?client_id=5059a88907e1b093c23df47d996183b101a862a5e53e099b563120d1308db2c1&redirect_uri=https://projects.gitlab.io/auth&response_type=code&state=bCN5ylZVNsjKt33cFslzNw==&scope=api
Resolving gitlab.com (gitlab.com)... 172.65.251.78, 2606:4700:90:0:f22e:fbec:5bed:a9b9
Connecting to gitlab.com (gitlab.com)|172.65.251.78|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://gitlab.com/users/sign_in [following]
--2021-09-24 13:33:34--  https://gitlab.com/users/sign_in
Reusing existing connection to gitlab.com:443.
HTTP request sent, awaiting response... 503 Service Temporarily Unavailable
2021-09-24 13:33:34 ERROR 503: Service Temporarily Unavailable.

类似的结果来自:

wget 'https://oauth2:XYZXYZXYZXYZXYZXYZXY@https://ourdev.gitlab.io/this/is/my/documentation'
curl -ILs --header "Authorization: Bearer XYZXYZXYZXYZXYZXYZXY" "https://ourdev.gitlab.io/this/is/my/documentation"

一切似乎都导致https://gitlab.com/users/sign_in503紧随其后。

许多文章展示了如何使用 PAT 访问 GitLab API。也许它们不是简单请求页面的方式?

4

1 回答 1

0

GitLab 开发人员说(一年前)“目前不可能”:

以编程方式访问私有页面

于 2021-09-24T16:43:50.950 回答