Skip to content

[Bug]: Login GitHub #4795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
Stanixia opened this issue Jan 26, 2022 · 27 comments
Closed
3 tasks done

[Bug]: Login GitHub #4795

Stanixia opened this issue Jan 26, 2022 · 27 comments
Assignees
Labels
high-priority This issue needs to be resolved ASAP
Milestone

Comments

@Stanixia
Copy link

Stanixia commented Jan 26, 2022

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

  1. git push -u origin main

Expected

Have github authentication message

Actual

Error committing github

Logs

No response

Screenshot/Video

image
image
image

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

@Stanixia Stanixia added bug Something isn't working triage This issue needs to be triaged by a maintainer labels Jan 26, 2022
@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 26, 2022

Argh. I can't reproduce locally on macOS + Brave but obviously that's because I've already authenticated with Git. We've had this in the past and I know @code-asher has fixed it.

image

What happens if you open the Command Palette > "Publish to GitHub" > enter your PAT? Does that work?

@jsjoeio jsjoeio added waiting-for-info Waiting for more information from submitter and removed bug Something isn't working triage This issue needs to be triaged by a maintainer labels Jan 26, 2022
@Stanixia
Copy link
Author

Hi,

It's ok if I use git remote add origin and PAT

I use Brave and Windows or MacOs but my setup is a Ubuntu 20.04 in a VPS and Docker container in my VPS
I also use Nginx Proxy Manager for external with a SSL

It's possible the proxy doesn't work with github callback ?

@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 27, 2022

It's ok if I use git remote add origin and PAT

awesome!

It's possible the proxy doesn't work with github callback ?

Possibly 🤔 I wish I knew how to reset my Git auth locally so I could actually try to reproduce. There's a possibility it's broken and not related to your proxy

@SelfMadeSystem
Copy link

SelfMadeSystem commented Jan 28, 2022

Happens on MacOS BigSur (11.4) and Arch Linux, both with firefox and vivaldi (code-server hosted on arch)

@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 28, 2022

Thanks @True-cc!

What happens if you open the Command Palette > "Publish to GitHub" > enter your PAT? Does that work?

For now you can use this workaround^

@jsjoeio jsjoeio added needs-investigation This issue needs to be further investigated high-priority This issue needs to be resolved ASAP and removed waiting-for-info Waiting for more information from submitter labels Jan 28, 2022
@jsjoeio jsjoeio added this to the On Deck - High Priority milestone Jan 28, 2022
@Stanixia
Copy link
Author

image

Settings Sync

@plckr
Copy link

plckr commented Feb 12, 2022

What happens if you open the Command Palette > "Publish to GitHub" > enter your PAT? Does that work?

@jsjoeio this method doesn't work for me because the window doesn't let me insert the PAT, it opens the error link directly

$ code-server --version
4.0.2 5cdfe74686aa73e023f8354a9a6014eb30caa7dd

@jsjoeio
Copy link
Contributor

jsjoeio commented Feb 14, 2022

@ricreis394 can you share a video?

@plckr
Copy link

plckr commented Feb 14, 2022

@ricreis394 can you share a video?

@jsjoeio sure, here it goes
Animation

@jsjoeio
Copy link
Contributor

jsjoeio commented Feb 14, 2022

@ricreis394 Ah that's a different flow than the one I'm referring to. Mine asks for a PAT inside code-server 🤔 I wonder if it's cause I'm using the PWA. I have no idea

image

What happens if you hit cancel?

@plckr
Copy link

plckr commented Feb 14, 2022

What happens if you hit cancel?

@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...

@jsjoeio
Copy link
Contributor

jsjoeio commented Feb 14, 2022

@ricreis394 hmm...I mean we had a big upgrade for VS Code in 4 so maybe it reset there? I'm not sure.

I don't know when I'll be able to look into this cause I can't easily reproduce :( But I'll add it to the high priority list. Or see if I can add it in next month's sprint.

@jsjoeio
Copy link
Contributor

jsjoeio commented Feb 14, 2022

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.

@plckr
Copy link

plckr commented Feb 14, 2022

@jsjoeio anything I can do to help debug the issue?

@chrisdburr
Copy link

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
Copy link
Contributor

jsjoeio commented Feb 15, 2022

@jsjoeio anything I can do to help debug the issue?

Hmm...you were very helpful with the video! I wish there was a way to reproduce it consistently. One thing you could do is grab the authorization URL that opens in the browser (be sure to remove the auth token from the URL) and share it here?

I know we've patched that in the past so I'm guessing we lost that patch. cc @code-asher

However, it asks for the PAT each time I try to push a commit.

Thank you @chrisdburr! That is usually a separate error that means your credential helper isn't caching your credentials. This has helped me in the past.

@code-asher
Copy link
Member

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.

@code-asher code-asher self-assigned this Feb 15, 2022
@plckr
Copy link

plckr commented Feb 15, 2022

Hmm...you were very helpful with the video! I wish there was a way to reproduce it consistently. One thing you could do is grab the authorization URL that opens in the browser (be sure to remove the auth token from the URL) and share it here?

@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.com

Not sure what to hide, so I hidden the requestId and the State

@steilerDev
Copy link

steilerDev commented Feb 18, 2022

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 :D )

P.S.: About Screen:

code-server: v4.0.2
VS Code: v1.63.0
Commit: 5cdfe74686aa73e023f8354a9a6014eb30caa7dd
Date: 2022-01-27T22:22:39Z (3 wks ago)
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36

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.com

@cnfatal
Copy link

cnfatal commented Feb 20, 2022

#1883 (comment) resolved temporarily

@plckr
Copy link

plckr commented Feb 20, 2022

Used the below method and worked as a temporary workaround

  1. CTRL + Shift + P ▶️ Publish to Github
  2. Will show a window asking permission to allow signin, press Allow
  3. Extract the state from the url opened and insert that in this url https://vscode-auth.github.com/authorize/?callbackUri=vscode://vscode.github-authentication/did-authenticate&scope=repo,workflow&state=<insert-state-from-code-server-here>&responseType=code
  4. open the new url in the browser, and allow sign in, after submitting it will generate a new url/code. Copy that generated url that will be something like this: vscode://vscode.github-authentication/did-authenticate?code=<code>&state=<state>
  5. go to code-server and click on "Signing in to GitHub" on the taskbar. It then will ask for the URI and paste the url
  6. And boom, you're logged in!

Credits: #1883 (comment)

@steilerDev
Copy link

steilerDev commented Feb 20, 2022

Build a little script using the method above to get the URL.

#!/bin/bash

read -p "VSCode GH Auth URL:" URL

STATE=$(echo $URL | awk -F'[=&]' '{print $6}')

NEW_URL="https://vscode-auth.github.com/authorize/?callbackUri=vscode://vscode.github-authentication/did-authenticate&scope=repo,workflow,read:user,user:email&state=${STATE}&responseType=code"

clear
echo 
echo "1. Access URL below & grant access"
echo
echo $NEW_URL
echo
echo "2. Don't use 'Open with VSCode...'"
echo "3. Copy the token."
echo "4. Switch back to VS code."
echo "5. Click Signing in to github.com... in the status bar."
echo "6. Paste the token and hit enter."

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=repo should be sufficient for the git integration.

@SelfMadeSystem
Copy link

If nothing else works, maybe having that within code-server could be the best solution?

@aliuq
Copy link

aliuq commented Feb 21, 2022

me too, same enviroment with u

@jsjoeio
Copy link
Contributor

jsjoeio commented Feb 22, 2022

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!

@jsjoeio
Copy link
Contributor

jsjoeio commented Feb 24, 2022

A fix will be available in the next release!

@aliuq
Copy link

aliuq commented Feb 24, 2022

A fix will be available in the next release!

Thank you

code-asher added a commit to coder/vscode that referenced this issue Feb 24, 2022
* Restore auth relay patch

Fixes coder/code-server#4795.

* Fix callback URIs behind a sub-path
@code-asher code-asher removed the needs-investigation This issue needs to be further investigated label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high-priority This issue needs to be resolved ASAP
Projects
None yet
Development

No branches or pull requests

9 participants