microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.05k stars 29.22k forks source link

github login failed every time #160649

Closed tsgsz closed 1 year ago

tsgsz commented 2 years ago

Type: Bug

The login step in browser is good, and successfull, but when redirect to vscode, vscode can also recive the redirect request, because it will pop up a window to ask me if allow it, but after that, it stuck until timeout

VS Code version: Code 1.71.0 (784b0177c56c607789f9638da7b6bf3230d47a8c, 2022-09-01T07:36:10.600Z) OS version: Windows_NT x64 10.0.22000 Modes: Sandboxed: No Remote OS version: Linux x64 3.10.0-1127.19.1.el7.x86_64

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz (4 x 3300)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|undefined| |Memory (System)|31.91GB (24.16GB free)| |Process Argv|--crash-reporter-id a72f7270-60dd-4eec-8d30-1feb1135c48c| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|SSH: 阿里云| |OS|Linux x64 3.10.0-1127.19.1.el7.x86_64| |CPUs|Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz (2 x 2499)| |Memory (System)|7.64GB (4.40GB free)| |VM|25%|
Extensions (11) Extension|Author (truncated)|Version ---|---|--- vscode-docker|ms-|1.22.1 vscode-language-pack-zh-hans|MS-|1.71.9070915 python|ms-|2022.14.0 vscode-pylance|ms-|2022.9.10 jupyter|ms-|2022.8.1002431955 jupyter-keymap|ms-|1.0.0 jupyter-renderers|ms-|1.0.9 remote-ssh|ms-|0.84.0 remote-ssh-edit|ms-|0.80.0 remote-wsl|ms-|0.66.3 vim|vsc|1.23.2
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vsdfh931:30280409 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411cf:30557515 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vscaat:30438848 pylanb8912:30545647 vsclangdf:30486550 c4g48928:30535728 hb751961:30553087 dsvsc012:30540252 azure-dev_surveyone:30548225 i497e931:30553904 ```
tsgsz commented 2 years ago

And I have tried win11, win10, MACOS, also with proxy or not with proxy, nothing helped

tsgsz commented 2 years ago

Any update ?

TylerLeonhardt commented 2 years ago

Sorry could you attach a video or a gif? That would really help me understand what you're seeing.

/gifPlease

vscodenpa commented 2 years ago

Thanks for reporting this issue! Unfortunately, it's hard for us to understand what issue you're seeing. Please help us out by providing a screen recording showing exactly what isn't working as expected. While we can work with most standard formats, .gif files are preferred as they are displayed inline on GitHub. You may find https://gifcap.dev helpful as a browser-based gif recording tool.

If the issue depends on keyboard input, you can help us by enabling screencast mode for the recording (Developer: Toggle Screencast Mode in the command palette).

Happy coding!

ronakay22 commented 2 years ago

How do I make y'all stop sending me emails. I don't even do git hub

On Fri, Sep 16, 2022, 10:28 PM VSCode Triage Bot @.***> wrote:

Thanks for reporting this issue! Unfortunately, it's hard for us to understand what issue you're seeing. Please help us out by providing a screen recording showing exactly what isn't working as expected. While we can work with most standard formats, .gif files are preferred as they are displayed inline on GitHub. You may find https://gifcap.dev helpful as a browser-based gif recording tool.

If the issue depends on keyboard input, you can help us by enabling screencast mode for the recording (Developer: Toggle Screencast Mode in the command palette).

Happy coding!

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode/issues/160649#issuecomment-1249988436, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXGLKFLPWU64DHSPYDGR2A3V6U3FTANCNFSM6AAAAAAQJZIYBE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

tsgsz commented 2 years ago

/gif GIF 2022-9-21 星期三 23-58-30 sorry for the gif delay

TylerLeonhardt commented 2 years ago

can you provide the contents of the GitHub Authentication output pane: image

And also anything that shows up in Dev Tools:

tsgsz commented 2 years ago

can you provide the contents of the GitHub Authentication output pane: image

And also anything that shows up in Dev Tools:

  • ctrl + shift + P
  • "Dev Tools"

0751fbe21786314d50f2a02646c4862 Nothing else

TylerLeonhardt commented 2 years ago

Very interesting... you see the spinning sign in to github.com... in your status bar... can you click on that and click cancel and then it'll ask you via a notification if you want to try logging in a different way... can you try that? Let me know if you need a video to understand what I'm talking about.

tsgsz commented 2 years ago

Very interesting... you see the spinning sign in to github.com... in your status bar... can you click on that and click cancel and then it'll ask you via a notification if you want to try logging in a different way... can you try that? Let me know if you need a video to understand what I'm talking about.

Already tried so many times, here is the result GIF 2022-10-2 星期日 10-58-25

tsgsz commented 2 years ago

Very interesting... you see the spinning sign in to github.com... in your status bar... can you click on that and click cancel and then it'll ask you via a notification if you want to try logging in a different way... can you try that? Let me know if you need a video to understand what I'm talking about.

Hi, any update? This problem keeps me can't use the codepolit actually, and I really really want to try...

tsgsz commented 2 years ago

Very interesting... you see the spinning sign in to github.com... in your status bar... can you click on that and click cancel and then it'll ask you via a notification if you want to try logging in a different way... can you try that? Let me know if you need a video to understand what I'm talking about.

Already tried so many times, here is the result GIF 2022-10-2 星期日 10-58-25 GIF 2022-10-2 星期日 10-58-25

Hi, is there any update?

TylerLeonhardt commented 2 years ago

@tsgsz let's try to get you unblocked first... can you open up Windows Credential Manager and go to Windows Credentials image

Then look for any credentials that start with vscode and delete them. Then try logging in again.

tsgsz commented 2 years ago

@tsgsz let's try to get you unblocked first... can you open up Windows Credential Manager and go to Windows Credentials image

Then look for any credentials that start with vscode and delete them. Then try logging in again

There is no credentials that start with vscode, I delete all of the rest credentials and loggin again, the result is all the same.

I really don't think it's the credential problem, because couple of days ago, I try it in my mac, didn't work either, and my windows also resinstalled once, nerver work.

TylerLeonhardt commented 2 years ago

Let's see if this is a keytar issue then... first log in in vscode (even though it fails)

if you have nodejs installed, you can run this simple one-liner to see if the problem is how your keychain is setup:

npx @emacs-grammarly/keytar-cli find-creds -s vscodevscode.github-authentication

or if you're on Insiders:

npx @emacs-grammarly/keytar-cli find-creds -s vscode-insidersvscode.github-authentication

This is using the following open source package: https://github.com/emacs-grammarly/keytar-cli

What you should get is something like this:

[
  {
    account: 'github.auth',
    password: '....... longggg string ......'
  }
]

NOTE: on macOS I got a system prompt to allow this process to access the keychain... that may or may not be the case for you

Additionally, we can see if we can properly set passwords:

npx @emacs-grammarly/keytar-cli set-pass testingvscode testingvscode testingvscode

and then

npx @emacs-grammarly/keytar-cli find-creds -s testingvscode

should give us that newly created password.

tsgsz commented 2 years ago

Let's see if this is a keytar issue then... first log in in vscode (even though it fails)

if you have nodejs installed, you can run this simple one-liner to see if the problem is how your keychain is setup:

npx @emacs-grammarly/keytar-cli find-creds -s vscodevscode.github-authentication

or if you're on Insiders:

npx @emacs-grammarly/keytar-cli find-creds -s vscode-insidersvscode.github-authentication

This is using the following open source package: https://github.com/emacs-grammarly/keytar-cli

What you should get is something like this:

[
  {
    account: 'github.auth',
    password: '....... longggg string ......'
  }
]

NOTE: on macOS I got a system prompt to allow this process to access the keychain... that may or may not be the case for you

Additionally, we can see if we can properly set passwords:

npx @emacs-grammarly/keytar-cli set-pass testingvscode testingvscode testingvscode

and then

npx @emacs-grammarly/keytar-cli find-creds -s testingvscode

should give us that newly created password.

npx @emacs-grammarly/keytar-cli find-creds -s vscodevscode.github-authentication this return "[]" npx @emacs-grammarly/keytar-cli set-pass testingvscode testingvscode testingvscode this is normal

and I manually set vscodevscode.github-authentication using the set-pass command, the output keytar is ok, just vsocde still can't login

tsgsz commented 2 years ago

My friend, any clue?

tsgsz commented 2 years ago

Hi, is there anyone still working on this issue?

TylerLeonhardt commented 2 years ago

I just got back from vacation and am juggling multiple items. This issue hasn't been forgotten

tsgsz commented 2 years ago

I just got back from vacation and am juggling multiple items. This issue hasn't been forgotten

thanks

TylerLeonhardt commented 2 years ago

@tsgsz can you run these two lines in PowerShell and tell me what you get?

Invoke-RestMethod -Method Post https://vscode.dev/codeExchangeProxyEndpoints/github/login/oauth/access_token
Invoke-RestMethod -Method Post https://vscode.dev/codeExchangeProxyEndpoints/github/login/oauth/access_token -Body 'code=123'

They will fail, but I want to make sure you at least get a response from the server

tsgsz commented 2 years ago

result as follow:

03799d05ee50ac0bbd50e52c5969ee5

the text version: Invoke-RestMethod : No code property provided in body

Invoke-RestMethod : bad_verification_code: The code passed is incorrect or expired. (https://docs.github.com/apps/managing-oauth-apps/troubleshooting-oauth-app-access-token-request-errors/#bad-verification-code)

tsgsz commented 1 year ago

knock knock

TylerLeonhardt commented 1 year ago

Believe it or not, but I was on another vacation. I'm back now... til the holidays... so hopefully we can make some progress here.

It's good that PowerShell was able to make a request to these urls... that's worth something. Though, to be honest, I'm not sure why VS Code would be having trouble here.

Do you have any proxies applied to your machine by your organization?

One thing we could try... have you used Fiddler before? Fiddler can be used to see if the request to vscode.dev/codeExchangeProxyEnd..... actually finishes. By installing that, and running it, it should start listening to the traffic that your machine makes and print it out:

Image

melMass commented 1 year ago

Hi,

I've just read the full issue and I have the exact same issue. I'm using ssh keys to login to github, this works everywhere except in vscode. image

It does popup the browser login window image

But clicking signing with browser just goes to a blank localhost page most of the time, once it did show me a successfully login you can go back to the app, but in vscode it was still complaining.

npx @emacs-grammarly/keytar-cli find-creds -s vscode-insidersvscode.github-authentication Returns

[
  {
    account: 'github.auth',
    password: 'AQxlmzCMdedeFgtEgtjogfetgwt/lfsAefgAgteagt3geugtYerSgetOYrDD\n' +
      'Blablablabal(removed)'
  }
]

And this is Github Auth Log: image

This only happens on my windows machine and funny to note that while trying to solve this, every single commits had a different user... not sure why but it might be related: image

TylerLeonhardt commented 1 year ago

That doesn't seem to be related. VS Code does not open those popups. My guess is that Git Credential Manager or your shell does. I got a new issue going for you.

tsgsz commented 1 year ago

Sorry for the late reply, got sick for sometime, covid, I've got a new situation, my last computer naturally ok for days ago(I've done nothing, and no update), but my new mac can't login, exactly the same behavior, which remind me maybe there is some token or other thing time related?

TylerLeonhardt commented 1 year ago

Hey @tsgsz, hope you're feeling better. COVID sucks. For macOS, how did you install it. Could you record a video of you going through the flows? I'd love it if you could try the fallback flows to see if any work for you.

vscodenpa commented 1 year ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

tsgsz commented 1 year ago

I have 2 macs, one is new, so I can't use setting sync and code pilot, but one is old, it use to login successfully in setting sync, but now can't login with pilot, which looks like this

截屏2023-01-21 上午9 59 00

This is interesting now, I have 3 computers, 2 mac, 1 pc, pc now can do everything(I did nothing actually, it just became fine one day), one mac can sync settings but no code pilot, one mac can do nothing...

tsgsz commented 1 year ago

Very interesting... you see the spinning sign in to github.com... in your status bar... can you click on that and click cancel and then it'll ask you via a notification if you want to try logging in a different way... can you try that? Let me know if you need a video to understand what I'm talking about.

Already tried so many times, here is the result GIF 2022-10-2 星期日 10-58-25 GIF 2022-10-2 星期日 10-58-25

The video you want is exaclty the same with this, but in mac

tsgsz commented 1 year ago

I check the "can do nothing" mac's key chain, compare to the "can do one thing" mac, the result like below

截屏2023-01-21 上午10 08 43
dineshyadav3169 commented 1 year ago

same issue

sketing commented 1 year ago

same issue

lrlunin commented 1 year ago

same issue

TylerLeonhardt commented 1 year ago

The "same issue" comments... please just use the +1 reaction feature of GitHub. We call this out in our wiki: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions#before-submitting-an-issue

A new version of VS Code will be going out today that has a fix that might help in this space. Can you get it and tell me how it goes?

tsgsz commented 1 year ago

The "same issue" comments... please just use the +1 reaction feature of GitHub. We call this out in our wiki: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions#before-submitting-an-issue

A new version of VS Code will be going out today that has a fix that might help in this space. Can you get it and tell me how it goes?

just tried, nothing changed

ThrowMeForALoop commented 1 year ago

same issue on windows

tsgsz commented 1 year ago

Any update? or any clue?

tsgsz commented 1 year ago

I have one pc, and one mac to be good now, only one mac(but my mac in company doesn't work), hope before it became ok, I can help u find the bug...

TylerLeonhardt commented 1 year ago

I had another idea. My goal is the try to understand where you get stuck.

Run vscode in a terminal with the flag --disable-keytar.

If you are able to complete the login flow, then the issue is talking to the keychain on your OS.

This disables persistent auth sessions so reloading the window will throw out your login session but at least we'll have more information.

tsgsz commented 1 year ago

I had another idea. My goal is the try to understand where you get stuck.

Run vscode in a terminal with the flag --disable-keytar.

If you are able to complete the login flow, then the issue is talking to the keychain on your OS.

This disables persistent auth sessions so reloading the window will throw out your login session but at least we'll have more information.

got this: image

TylerLeonhardt commented 1 year ago

Now that's unusual. I don't repro that. Also, my error is different when I run with a command that isn't real:

Image

This is the one on your Mac, yes? My code comes from /usr/local/bin/code (running which code)... what does yours say? Also what does code --help and code --version output.

tsgsz commented 1 year ago

Now that's unusual. I don't repro that. Also, my error is different when I run with a command that isn't real:

Image

This is the one on your Mac, yes? My code comes from /usr/local/bin/code (running which code)... what does yours say? Also what does code --help and code --version output.

my vscode is the latest version in office website, mac osx intel, is that the same?

tsgsz commented 1 year ago

Now that's unusual. I don't repro that. Also, my error is different when I run with a command that isn't real:

Image

This is the one on your Mac, yes? My code comes from /usr/local/bin/code (running which code)... what does yours say? Also what does code --help and code --version output.

image

yes, this is the one on my mac

TylerLeonhardt commented 1 year ago

Apparently, this flag is not available in the standalone CLI but is in the normal CLI... anyway, another way to do this is to run:

Preferences: Configure Runtime Arguments

and add a "disable-keytar": true

it will say it's not allowed, but it is. Ignore the warning and restart (kill and start) VS Code.

tsgsz commented 1 year ago

Apparently, this flag is not available in the standalone CLI but is in the normal CLI... anyway, another way to do this is to run:

Preferences: Configure Runtime Arguments

and add a "disable-keytar": true

it will say it's not allowed, but it is. Ignore the warning and restart (kill and start) VS Code.

find a way to do it anyway, disable succeed, like this: image

But the problem still the same, nothing changed, like this: image

tsgsz commented 1 year ago

After disable the keytar, everything is exactly the same like before

TylerLeonhardt commented 1 year ago

@tsgsz just to be perfectly sure... with keytar disabled, can you share the contents of the Main output channel?

tsgsz commented 1 year ago

@tsgsz just to be perfectly sure... with keytar disabled, can you share the contents of the Main output channel?

like this image