code-server: GitHub login redirect fails due to missing subpath

OS/Web Information

  • Web Browser: Firefox
  • Local OS: Windows10
  • Remote OS: Ubuntu 20.04
  • Remote Architecture: amd64
  • code-server --version: 3.11.1

Steps to Reproduce

  1. click the link: 图片
  2. The page shows 404 not found.
  3. Login failed.

Expected

Login to github without failing.

Actual

Failed logining into GitHub.

Logs

Screenshot

Notes

This issue can be reproduced in VS Code: No

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 31 (15 by maintainers)

Most upvoted comments

Sure. I will mention the issue with the GitLens team.

Ah yup there is a bug where the redirect URL does not include the sub-path. It should be a simple fix but I have not had the chance to look into it.

Here is the entrance:

image

I’ve tried that approach, but it results in Bad Request.

Here is the solution to connect your GitLens Pro account in hosted code-server: 1: Click on the signing link as shown in the screenshot: signin-gitlens-code-server

2: Allow the usage of GitLens+: signin-gitlens-code-server-allow

3: “Copy” the link: signin-gitlens-copy-link

4: From the link, extract the gkstate value: example: b4bbb363-b3e5-4014-efb8-a7a0f9e42135

5: Replace GKSTATE_HERE in the link below with your own gkstate: ⚠️ Careful not to touch the D before, nor the % after the gkstate.

https://app.gitkraken.com/register?referrer=gitlens&pass-token=true&return-url=vscode%3A%2F%2Feamodio.gitlens%2Fdid-authenticate%3Fgkstate%253DGKSTATE_HERE%2526windowId%253D2

6: Open the new URL from step 5 in your browser (not in code-server) and connect to your GitLens Pro account, then the page would redirect to a validation page where you must copy the Authorization URL (do not click on Open in VSCode, if the popup is presented to you as this will open the local vscode and not your hosted Code-Server) signin-gitlens-copy-authorization-url

7: Paste the Authorization URL in the popup in Code-Server: signin-gitlens-paste-url-and-enter

8: Voila: code-server-gitlens-pro-signin

Nearly six months for this comment that I initially sent through email to arrive. How strange. 😛

Ahhh my bad I was thinking about the builtin git extension.

It looks like GitLens uses asExternalUri to generate the redirect URI: https://github.com/gitkraken/vscode-gitlens/blob/ec6e207eae89c87152cff89d70f415cc82602527/src/plus/subscription/serverConnection.ts#L113-L120

So I bet we need to patch asExternalUri to include the full path rather than just the host.

I think I might have fixed this (I must have forgotten this issue existed). Is is still present in latest code-server?

I am using such an approach, but it asks me for the token each time I do git pull or anything else that requires authentication.

Usually when this happens, I think it means git isn’t caching your credentials. Have you tried this?

Thanks, it worked. My bad, didn’t check this, just thought it’s an issue with the code-server. 🤦🏻

No worries! I’ve changed the title to reflect so and added to On Deck. @Nick-Hopps can’t tell you when we’ll get to it, but it’s on the list and will be in an upcoming milestone in the future!

It’s ok and thx again.

I’ll let @code-asher chime in and see if he is able to reproduce the issue with the callback

Wow, it works for me! Thx very much. If only callback also works, it’d be perfect.