code-server: [Bug]: Login GitHub
Is there an existing issue for this?
- I have searched the existing issues
OS/Web Information
- Web Browser: Version 1.34.81 Chromium: 97.0.4692.99 (Build officiel) (64 bits)
- Local OS: Windows 10
- Remote OS: Docker (codercom/code-server:latest)
- Remote Architecture:
code-server --version: 4.0.1
Steps to Reproduce
- git push -u origin main
Expected
Have github authentication message
Actual
Error committing github
Logs
No response
Screenshot/Video

Does this issue happen in VS Code?
- I cannot reproduce this in VS Code.
Are you accessing code-server over HTTPS?
- I am using HTTPS.
Notes
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 12
- Comments: 27 (11 by maintainers)
Commits related to this issue
- Fix GitHub authentication (#47) * Restore auth relay patch Fixes https://github.com/coder/code-server/issues/4795. * Fix callback URIs behind a sub-path — committed to coder/vscode by code-asher 2 years ago
Heads-up: for anyone else experiencing this, please give a thumbs-up on the issue description! That will help me see how many people are affected by this and prioritize properly.
Based on the reports, this might be due to our setup. I’m experiencing the same issue with my docker (
codercom/code-server:latest) + nginx-proxy (with lets-encrypt support).This issue happens on all browsers I tried (latest Chrome/Safari/Brave on macOS + Safari on iPad).
The workaround in #1883 still works. (Unfortunately the Github Login seems to be stored locally in the browser, which means I’d need to perform this everytime I’m switching clients. On the bright side, using inkognito mode should give you a ‘clean’ instance to reproduce @jsjoeio)
In my opinion storing and using a PAT on the server would be the best way, so I won’t need to re-authenticate when using a new client. (But I’m new to this project, so I have no idea if this is even remotely possible 😄 )
P.S.: About Screen:
P.P.S: The request is similiar to the one above:
https://vscode-auth.github.com/authorize/?callbackUri=https://coder.<domain>.net/callback%253Fvscode-requestId%<reqID>%2526vscode-scheme%253Dcode-oss%2526vscode-authority%253Dvscode.github-authentication%2526vscode-path%253D%25252Fdid-authenticate&scope=repo%20workflow&state=<state>&responseType=code&authServer=https://github.comBuild a little script using the method above to get the URL.
EDIT: As you can see this requests for
scope=repo,workflow,read:user,user:email, since I’m using the Workflow Plugin and the Issues Plugin.scope=reposhould be sufficient for the git integration.Thank you @ricreis394 for the solution and @steilerDev for the killer script 🔥
Hoping this is a quick fix on our end. We had yesterday off but we’re back this week. Thanks for the patience!
A fix will be available in the next release!
If nothing else works, maybe having that within code-server could be the best solution?
Used the below method and worked as a temporary workaround
Allowstatefrom the url opened and insert that in this urlhttps://vscode-auth.github.com/authorize/?callbackUri=vscode://vscode.github-authentication/did-authenticate&scope=repo,workflow&state=<insert-state-from-code-server-here>&responseType=codevscode://vscode.github-authentication/did-authenticate?code=<code>&state=<state>Credits: https://github.com/coder/code-server/issues/1883#issuecomment-712595418
@jsjoeio
https://vscode-auth.github.com/authorize/?callbackUri=<ip>:8443/callback%253Fvscode-requestId%253D<hiddenRequestId>%2526vscode-scheme%253Dcode-oss%2526vscode-authority%253Dvscode.github-authentication%2526vscode-path%253D%25252Fdid-authenticate&scope=repo%20workflow&state=<hiddenState>&responseType=code&authServer=https://github.comNot sure what to hide, so I hidden the requestId and the State
You are probably right about it being lost. I will need to be in this code soon for other reasons so I will take a look.
@jsjoeio It just cancels. Won’t do anything I’m using code behind a reverse proxy (nginx), at first I thought that could be the problem, but nope. The gif I sent is from direct IP connection, no redirections
The strange thing is, before version 4, I was logged in on github, don’t know why it logged out…
Thank you
https://github.com/coder/code-server/issues/1883#issuecomment-659836909 resolved temporarily
Not sure if this helps, but I can push to GH using username and PAT after cancelling the default login option. However, it asks for the PAT each time I try to push a commit.
Information:
OS: Debian Bullseye Code-Server: Docker Container (Latest) Browser: iPad (Safari)
@jsjoeio this method doesn’t work for me because the window doesn’t let me insert the PAT, it opens the error link directly
Settings Sync
Happens on MacOS BigSur (11.4) and Arch Linux, both with firefox and vivaldi (code-server hosted on arch)