Skip to content
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

Login with Github Fails, even when VSCode Launched as Admin #1005

Open
8thHalfHour opened this issue Aug 14, 2019 · 34 comments
Open

Login with Github Fails, even when VSCode Launched as Admin #1005

8thHalfHour opened this issue Aug 14, 2019 · 34 comments

Comments

@8thHalfHour
Copy link

8thHalfHour commented Aug 14, 2019

🐛 Describe the bug
"Login with Github" fails on Win 10 Pro, even when VS Code is launched as admin.

🌴 Visual Studio Code Version : 1.37.0
🌴 Code Settings Sync Version : 3.4.1
🌴 Standard or Insiders : Standard
🌴 Portable or Installed : Installed
🌴 OSS or Official Build : Official
🌴 Operating System : Win 10 Pro
🌴 Occurs On: Help Configuring
🌴 Proxy Enabled: No
🌴 Gist Id: Didn't get to get that far

📰 To Reproduce
Steps to reproduce the behavior:

  1. Open VS Code as Administrator.
  2. The Settings Sync page loads.
  3. Click on 'Login with Github.'
  4. Command sent to browser with URL: https://github.com/login/oauth/authorize?scope=gist%20read:user&client_id=cfd96460d8b110e2351b&redirect_uri=http://localhost:54321/callback
  5. URL resolves to http://localhost:54321/callback?code=161f703d663c9664cd9e ending in error:

VS Code Settings Sync_Login Error

💪 Expected behavior
I expect to be logged into GitHub and for setup to continue.

@shanalikhan
Copy link
Owner

shanalikhan commented Aug 16, 2019

What is exception logged in the developer console?

@arnohovhannisyan can assist us on this :)

@8thHalfHour
Copy link
Author

@shanalikhan I am not sure I saw one. Where would I see this? In VS Code or in Chrome?

@shanalikhan
Copy link
Owner

In VS Code or in Chrome?

In VSCode, Help Menu > Toogle Developer Tools

Clear the console there and take a screenshot of exceptions when you reproduce the above steps.

@willstocks
Copy link

Hi @shanalikhan
I have just started seeing this exact same error, although I'm in a corporate environment behind a proxy so might be a slightly different use-case.

I had to allow code.exe to communicate through Windows Firewall (all allowed) but as soon as I click to add a gist, I get stuck on the callback screen and get the exact same error in the browser.

In Code, the following gets logged to the console:

HttpError: request to https://api.github.com/gists/4eaba17… failed, reason: self signed certificate in certificate chain
    at module.exports.then.then.catch.t (C:\Users\myusername\.vscode\extensions\shan.code-settings-sync-3.4.1\out\extension.js:761:1113)
    at process._tickCallback (internal/process/next_tick.js:68:7)
console.ts:137 
[Extension Host] HttpError: request to https://api.github.com/user failed, reason: self signed certificate in certificate chain
    at module.exports.then.then.catch.t (C:\Users\myusername\.vscode\extensions\shan.code-settings-sync-3.4.1\out\extension.js:761:1113)
    at process._tickCallback (internal/process/next_tick.js:68:7)

@willstocks
Copy link

When I click "Login with GitHub" as well, after a period of time I get the following two Code notifications:
image

I'm not sure why the "Enterprise URL" error shows there as I'm not using that (and it's optional?)?

@kzhangkzhang
Copy link

kzhangkzhang commented Aug 23, 2019

I am having the exact same issue

Settings Sync: V3.4.2
VS Code: 1.37.1

Any solutions?

my error:

Error: FetchError: request to https://github.com/login/oauth/access_token failed, reason: unable to get local issuer certificate at e. (C:\Users\kzhang.vscode\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:73883) at C:\Users\kzhang.vscode\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:71803 at Object.module.exports.i [as throw] (C:\Users\kzhang.vscode\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:71908) at s (C:\Users\kzhang.vscode\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:70705) at process._tickCallback (internal/process/next_tick.js:68:7)

@8thHalfHour
Copy link
Author

8thHalfHour commented Aug 23, 2019

Okay, so tried again today. I have no extensions enabled in Chrome while attempting this. The error I get in VS Code is:

ERR listen EACCES 0.0.0.0:54321: Error: listen EACCES 0.0.0.0:54321 at Server.setupListenHandle [as _listen2] (net.js:1269:19) at listenInCluster (net.js:1334:12) at Server.listen (net.js:1421:7) at Function.module.exports.x.listen (c:\Users\Moby\.vscode-insiders\extensions\shan.code-settings-sync-3.4.2\out\extension.js:653:4543) at e.<anonymous> (c:\Users\Moby\.vscode-insiders\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:72443) at c:\Users\Moby\.vscode-insiders\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:71803 at Object.module.exports.i [as next] (c:\Users\Moby\.vscode-insiders\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:71908) at a (c:\Users\Moby\.vscode-insiders\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:70654)

The error in Chrome is only this:

09:25:56.434 Navigated to chrome-error://chromewebdata/ 09:25:56.480 Navigated to chrome-error://chromewebdata/

It appears we are all getting different errors, lol. Interesting.

My versions of everything
VS Code Insiders: 1.38.0-insider
Chrome: 78.0.3887.7 (Official Build) dev (64-bit)

@elgandoz
Copy link

Same issue here, plain VS Code 1.37.1 , Sync 3.4.2 (as only extension), using Chrome or Edge.
I'm in corporate environment too.

FetchError: request to https://github.com/login/oauth/access_token failed, reason: unable to get local issuer certificate
at ClientRequest.<anonymous> (C:\Users\XXX\.vscode\extensions\shan.code-settings-sync-3.4.2\out\extension.js:151:24956)
at ClientRequest.emit (events.js:187:15)
at TLSSocket.socketErrorListener (_http_client.js:391:9)
at TLSSocket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)

@auxves
Copy link
Contributor

auxves commented Aug 30, 2019

@8thHalfHour As a temporary workaround, you can try manually creating an access token with the gist scope. Then you can set that as your token and optionally provide your existing gist.

@rm-bergmann
Copy link

rm-bergmann commented Sep 5, 2019

I'm getting the same issue. I installed settings sync on my work computer and it worked fine, then I installed it on my home computer and I can't login with github. Both Windows 10.

I noticed this URL param "&redirect_uri=http://localhost:54321/callback" in the authorization url, is that intentional? I didn't notice it the first time I installed it.

The browser redirects to http://localhost:54321/callback?code=xxxxxxxxx and therefore can't complete the process. I tried removing the URL param from the authorization URL, but it still redirects.

Then I tried the same thing in incognito mode, which gets me to the github login screen, and begins to authorize, but then redirects to the localhost URL and can't complete the process.

VS Code console error:

ERR listen EACCES 0.0.0.0:54321: Error: listen EACCES 0.0.0.0:54321
at Server.setupListenHandle [as _listen2] (net.js:1269:19)
at listenInCluster (net.js:1334:12)
at Server.listen (net.js:1421:7)
at Function.module.exports.x.listen (C:\Users\info.vscode\extensions\shan.code-settings-sync-3.4.2\out\extension.js:653:4543)
at e. (C:\Users\info.vscode\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:72443)
at C:\Users\info.vscode\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:71803
at Object.module.exports.i [as next] (C:\Users\info.vscode\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:71908)
at a (C:\Users\info.vscode\extensions\shan.code-settings-sync-3.4.2\out\extension.js:560:70654)

@ZhangYigeng
Copy link

ZhangYigeng commented Sep 13, 2019

I had the exact same issue here.
Windows 10
VS Code Stable: 1.38
Setting Sync: 3.4.2
Chrome: 76.0.3809.132
Also tried on Edge but not working.
Interesting is that I can use the 'Login with Github' button without any problem on another windows 10 machine with Chrome under the same WiFi.

Thank you all!

@sanbartels
Copy link

I had this same problem, in the console it showed the error "failed, reason: certificate has expired" and in google chrome the same error of @rm-bergmann appeared. I removed some unknown certificates from my keychain and the problem was solved, apparently these blocked access. Cheers, and I hope it helps you.

@Palats
Copy link

Palats commented Oct 23, 2019

I had a similar issue on Chromebook + crostini - i.e., I get the github auth, validate it and then the redirection to localhost:54321/callback?code=xxx fails.

The trick in that case (Chromebook/crostini specific) is to just replace "localhost" by "penguin.linux.test" (the address of the crostini VM) - works perfectly from there.

@Sth32
Copy link

Sth32 commented Oct 27, 2019

Manjaro Linux user.
I meet the same problem, localhost not response.
Unset $http_proxy in my enviroment and then it works good.

@daniel-refahi
Copy link

having the same issue and this is the error logs in console

workbench.desktop.main.js:sourcemap:3611 [[object Object]]listen EADDRINUSE: address already in use :::54321
$onExtensionRuntimeError @ workbench.desktop.main.js:sourcemap:3611
_doInvokeHandler @ workbench.desktop.main.js:sourcemap:3577
_invokeHandler @ workbench.desktop.main.js:sourcemap:3577
_receiveRequest @ workbench.desktop.main.js:sourcemap:3576
_receiveOneMessage @ workbench.desktop.main.js:sourcemap:3575
(anonymous) @ workbench.desktop.main.js:sourcemap:3573
fire @ workbench.desktop.main.js:sourcemap:115
fire @ workbench.desktop.main.js:sourcemap:372
_receiveMessage @ workbench.desktop.main.js:sourcemap:377
(anonymous) @ workbench.desktop.main.js:sourcemap:374
fire @ workbench.desktop.main.js:sourcemap:115
acceptChunk @ workbench.desktop.main.js:sourcemap:370
(anonymous) @ workbench.desktop.main.js:sourcemap:369
t @ workbench.desktop.main.js:sourcemap:380
emit @ events.js:200
addChunk @ _stream_readable.js:294
readableAddChunk @ _stream_readable.js:275
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
workbench.desktop.main.js:sourcemap:3611 Error: listen EADDRINUSE: address already in use :::54321
at Server.setupListenHandle [as _listen2] (net.js:1226:14)
at listenInCluster (net.js:1274:12)
at Server.listen (net.js:1362:7)
at Function.x.listen (c:\Users\RBTadministrator.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:653:4543)
at e. (c:\Users\RBTadministrator.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:72445)
at c:\Users\RBTadministrator.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:71805
at Object.next (c:\Users\RBTadministrator.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:71910)
at a (c:\Users\RBTadministrator.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:70656)

@ivankusuma07
Copy link

Having the same issue when clicking "login with github" button.
Visual Studio Code Version : 1.40.0
Code Settings Sync Version : 3.4.3

this is the error log from console.

Error: listen EADDRINUSE: address already in use :::54321
at Server.setupListenHandle [as _listen2] (net.js:1226:14)
at listenInCluster (net.js:1274:12)
at Server.listen (net.js:1362:7)
at Function.x.listen (c:\Users\ivank.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:653:4543)
at e. (c:\Users\ivank.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:72445)
at c:\Users\ivank.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:71805
at Object.next (c:\Users\ivank.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:71910)
at a (c:\Users\ivank.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:70656)

@zetako
Copy link

zetako commented Nov 14, 2019

Manjaro Linux user.
I meet the same problem, localhost not response.
Unset $http_proxy in my enviroment and then it works good.

manjaro user, too. Same problem and your solution works.Thanks!

@josemarcosrf
Copy link

I had a similar issue on Chromebook + crostini - i.e., I get the github auth, validate it and then the redirection to localhost:54321/callback?code=xxx fails.

The trick in that case (Chromebook/crostini specific) is to just replace "localhost" by "penguin.linux.test" (the address of the crostini VM) - works perfectly from there.

I can confirm that this works perfectly well when running from a chromebook.

@dsingler
Copy link

I had a similar issue on Chromebook + crostini - i.e., I get the github auth, validate it and then the redirection to localhost:54321/callback?code=xxx fails.

The trick in that case (Chromebook/crostini specific) is to just replace "localhost" by "penguin.linux.test" (the address of the crostini VM) - works perfectly from there.

This worked as well for me on my chromebook setup.

@kimoye
Copy link

kimoye commented Mar 11, 2020

I meet the same problem.I confirm that the first time to sign in github is OK, the first time to download setting is also OK. But upload is not good, when I reset the sync setting and second-sign-in Github, the problem appreas as same as everybody here.
My case is Win 10 1909 + VS Code 1.43

@jonyeezs
Copy link

I'm on ubuntu 19.10 | VSCode 1.44.0-insider
3.4.3

when i try to login via github, it passes the permissions page, and then fails on the http://localhost.etcetc.

As well it won't connect to my private gist.

FetchError: request to https://api.github.com/user failed, reason: unable to get local issuer certificate 

I do not have any proxy setup.

@RDhar
Copy link

RDhar commented May 31, 2020

Hi, I'm seeing this identical issue on a fresh installation of Windows 10 Pro where there are no proxies or corporate/enterprise firewalls.

Upon clicking “Login with Github”, I’m redirected to the following URL:

https://github.com/login/oauth/authorize?scope=gist%20read:user&client_id=cfd96460d8b110e2351b&redirect_uri=http://localhost:54321/callback

Which is automatically followed by a 302 redirection to the following erroneous callback URL:

http://localhost:54321/callback?code=1c00f98da01ed9cbab23

Note, I’m already logged in to complete GitHub authentication. Although nothing is present in the browser’s console, the following error is logged in VS Code’s console upon clicking the button.

mainThreadExtensionService.ts:65 [[object Object]]listen EACCES: permission denied 0.0.0.0:54321
$onExtensionRuntimeError @ mainThreadExtensionService.ts:65
_doInvokeHandler @ rpcProtocol.ts:402
_invokeHandler @ rpcProtocol.ts:387
_receiveRequest @ rpcProtocol.ts:303
_receiveOneMessage @ rpcProtocol.ts:230
(anonymous) @ rpcProtocol.ts:105
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166

mainThreadExtensionService.ts:66 Error: listen EACCES: permission denied 0.0.0.0:54321
	at Server.setupListenHandle [as _listen2] (net.js:1211:19)
	at listenInCluster (net.js:1276:12)
	at Server.listen (net.js:1364:7)
	at Function.x.listen (c:\Users\Rishav\.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:653:4543)
	at e.<anonymous> (c:\Users\Rishav\.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:72445)
	at c:\Users\Rishav\.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:71805
	at Object.next (c:\Users\Rishav\.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:71910)
	at a (c:\Users\Rishav\.vscode\extensions\shan.code-settings-sync-3.4.3\out\extension.js:560:70656)

Do let me know if any further information is required to help troubleshooting. Thanks for your time.

This is my environment setup versions:

Property Attribute
Settings Sync 3.4.3
VS Code 1.45.1 (user setup)
Electron 7.2.4
Chrome (VS Code) 78.0.3904.130
Chrome (browser) 84.0.4147.30
Node.js 12.8.1
V8 7.8.279.23-electron.0
OS Windows_NT x64 10.0.19041
OS (long) Windows 10 OS Version 2004 (Build 19041.264)

@RDhar
Copy link

RDhar commented Jun 1, 2020

Curiously, this appears to have resolved itself the next day after a cold reboot.

Worth mentioning that this time, upon clicking the "Login with GitHub" button, VS Code opened a new Windows Security Alert dialog where Windes Defender Firewall explicitly requested access to private or public networks on behalf of VS Code, similar to this screenshot.

Thanks!

@kylexu
Copy link

kylexu commented Jun 26, 2020

My default browser has a proxy set by the corporate environment, and cannot access localhost. I just copy the URL like http://localhost:54321/callback?code=xxxxxx to another browser without a proxy, then I can get "Success! You may now close this tab."

@MahmoudSharkawy
Copy link

have same problem

Sign in failed: FetchError: request to https://vscode-auth.github.com/token?code=*****************state=754cb518-a3a4-4a33-9cc7-72488d1f5597 failed, reason: getaddrinfo ENOTFOUND vscode-auth.github.com

@PixsaOJ
Copy link

PixsaOJ commented Dec 24, 2020

Same.

I just did my i3 window manager setup.
I am launching VSCode from Rofi application launcher. I launch Rofi with i3wm which is launched by gdm3.

GDM3>I3wm>Rofi>VSCODE

My .profile :

export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"

export XINITRC="${XDG_CONFIG_HOME:-$HOME/.config}/x11/xinitrc"
#export XAUTHORITY="$XDG_RUNTIME_DIR/.Xauthority" # This line will break some DMs.
export ICEAUTHORITY="$XDG_CACHE_HOME"/ICEauthority
export GTK2_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc-2.0"
export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/password-store"
export GNUPGHOME="${XDG_DATA_HOME:-$HOME/.local/share}/gnupg"
export VSCODE_PORTABLE="$XDG_DATA_HOME"/vscode
export BASH_COMPLETION_USER_FILE="$XDG_CONFIG_HOME"/bash-completion/bash_completion

Error I'm getting:
Sign in failed: FetchError: request to https://vscode-auth.github.com/token?code=*****************&state=c38d971c-b02f-439d-ba28-5aca53c57e83 failed, reason: getaddrinfo ECONNREFUSED vscode-auth.github.com

@iamtodor
Copy link

iamtodor commented Jan 9, 2021

Some time ago VSCode has released the official Settings Sync: https://code.visualstudio.com/docs/editor/settings-sync
I just heard about it. So I think some people might be not aware of this option and it might be quite useful.
I successfully moved, without ache.

@TheMuyu
Copy link

TheMuyu commented Mar 17, 2021

in 2021 i'm still getting this error.

@leonbloy
Copy link

Same here, it worked after a cold reboot

@PixsaOJ
Copy link

PixsaOJ commented Aug 18, 2021

Use official one guys + no gist will be used

@massoudmaboudi
Copy link

massoudmaboudi commented Aug 27, 2021

I have the same issue.

copyToken.js:2 Uncaught ReferenceError: token is not defined at copyToken.js:2

Either chrome or firefox.

@Rademenes16
Copy link

same issue
I tried firefox, edge and chrome

@richjames0
Copy link

I had the same issue and I think it might be because I run tunnels using sshuttle. I restarted my machine to be doubly sure I killed them all and then it worked. So either killing tunnels or just restarting fixed it

@mauricekindermann
Copy link

Still getting this error in 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests