Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

GitHub extension sign in issue #2509

Open
vasheth opened this issue May 4, 2020 · 16 comments
Open

GitHub extension sign in issue #2509

vasheth opened this issue May 4, 2020 · 16 comments

Comments

@vasheth
Copy link

vasheth commented May 4, 2020

I am trying to connect to my GitHub account from Visual Studio Extension and getting the issue as per attached image. I don't have anything running on 42549 port.

GitHubError

  • GitHub Extension for Visual Studio version: 2.11.96.24460
  • Visual Studio version: Visual Studio Enterprise 2019
@jcansdale
Copy link
Collaborator

Hello,

Could you have a look at the log file here:
%LOCALAPPDATA%\GitHubVisualStudio\extension.log

I'd be interested to know if there is anything that might be related to this in there?

@vasheth
Copy link
Author

vasheth commented May 5, 2020

Attaching the log file.
extension.log

@ttaylor29
Copy link

Here is my issue:

I added the GitHub extension in VS 2019.

I go to log in via my git hub account, and it redirects me to a localhost URL:

The link: "Sign in with your browser" takes you to this URL:
https://localhost:42549/?browser_session_id=096721046e76c425952c3be513b76cf837341569&code=3620be2877d57424d2ab&state=9d5c0e2a-89bc-41f0-a9da-413c1ff72ec4

extension.log

GitHubUrlError

@vasheth
Copy link
Author

vasheth commented May 14, 2020

@ttaylor29 Welcome to the party :) This is exactly my issue as well. I never got a resolution for this though.

@ttaylor29
Copy link

ttaylor29 commented May 14, 2020

@vasheth So you never got logged in at all?

@vasheth
Copy link
Author

vasheth commented May 14, 2020

@ttaylor29 That's correct. I had also raised this concern to GitHub support and they provided a few workarounds. None of them worked for me but I am listing them down below in case they do work for you.

  • Downgrade version of the extension
  • Disable any default browser plugins on the client end that could be interfering with the form fields
  • Verify that VS is running as an administrator; this is a required in order to allow the extension to connect
  • Remove the entries in the Windows Credential Manager and try authenticating again
  • Try logging in with just your username instead of email

Also, a very hard hitting response on this from GitHub Support was: "Unfortunately the Visual Studio Extension is not being as actively developed, so I do not have a firm timeline for any sort of fix".

@ttaylor29
Copy link

ttaylor29 commented May 14, 2020

@vasheth I uninstalled on my desktop computer Github VS extension and then reinstalled, and it redirects me to a proper URL that does not have localhost in it.

Weird thing is when I uninstalled (removed the extension) and added it back, I was already signed in. I wonder if I was already signed into GitHub on the web at that point. Then I signed out, signed back into the screen both of us posted, then it took me to the proper URL.

Here is the URL:

https://github.com/login?client_id=a200baed193bb2088a6e&return_to=%2Flogin%2Foauth%2Fauthorize%3Fclient_id%3Da200baed193bb2088a6e%26scope%3Duser%252Crepo%252Cgist%252Cwrite%253Apublic_key%252Cread%253Aorg%252Cworkflow%26state%3D22d5d1b1-8a2c-44ac-aaa9-e9a4a888745a

VS version:

Version 16.5.4

@vasheth
Copy link
Author

vasheth commented May 14, 2020

@ttaylor29 I did uninstall but I hadn't signed out. Let me try that as well.

@ttaylor29
Copy link

No fun - @vasheth.

Try my steps to see if that helps?

@ttaylor29
Copy link

ttaylor29 commented May 14, 2020

@vasheth I recreated it again:

This time the URL is:

http://localhost:42549/?browser_session_id=7586c454eb82dd82f94be0b2002ce54c00d3f989&code=429b6958240f905ca91c&state=61567760-11bf-45a3-aa37-c863a672d4eb

It opens Edge for me to sign in.

Open up your default browser

  1. Open up your default browser
  2. Sign in to git hub via your browser
  3. Then try signing into the extension via VS.
  4. I think the first time it went to localhost URL, it asked me to allow an extension and then took me to approve the application/extension

Previously, a first-party GitHub OAuth application (Visual Studio) had gist, read:org, repo, user, and write:public_key scopes. It was recently granted an additional scope (workflow). Visit https://github.com/settings/connections/applications/a200baed193bb2088a6e for more information.

To see this and other security events for your account, visit https://github.com/settings/security

If you run into problems, please contact support by visiting https://github.com/contact

And it looks like the browser URL on the screen capture we both posted is correct, but then I see this:

You are being redirected to the authorized application
If your browser does not redirect you back, please click here to continue.

Then at that point it redirects me to the URL: localhost.....

and shows this

image

@T-Ravi
Copy link

T-Ravi commented May 18, 2020

I'm also not able to connect to the Git Enterprise from Visual Studio 2017 Enterprise edition. The Sign In button stays in disabled even after entering the URL.

I'm using the latest version of the Extension. Do I need to use a different version to connect from VS 2017. If so, can some one please suggest which version to be used for VS 2017 Enterprise edition.

@techduggu
Copy link

Hi Team,

Even I am facing this issue with GitHub extension with Visual Studio 2019. I have tried the above workarounds (uninstalling/reverting to previous version etc.) but no luck.

I am able to sign-in successfully to GitHub on my browser but through extension, when I click on 'Sign in with your browser' option, it opens the browser with the below URL and it just keeps loading:
https://github.com/login/oauth/authorize?client_id=a200baed193bb2088a6e&scope=user%2Crepo%2Cgist%2Cwrite%3Apublic_key%2Cread%3Aorg%2Cworkflow&state=cd3677b8-bf82-4d2d-80c2-71fb3ed7cb63

Below is the error captured from Github Extension log:

2020-08-15 22:29:05.832 [20420] INFO [58] GitHubPackage Initializing GitHub Extension v2.11.104.25275 in Microsoft Visual Studio 2019 (16.6.30114.105)
2020-08-15 22:29:23.860 [20420] EROR [01] LoginTabViewModel Error logging into '"https://github.com/"' as ''
Octokit.AuthorizationException: Requires authentication
at Octokit.Connection.HandleErrors(IResponse response)
at Octokit.Connection.d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Octokit.Connection.d__571.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at GitHub.Api.LoginManager.<GetUserAndCheckScopes>d__23.MoveNext() in D:\a\VisualStudio\VisualStudio\src\GitHub.Api\LoginManager.cs:line 346 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at GitHub.Api.LoginManager.<ReadUserWithRetry>d__22.MoveNext() in D:\a\VisualStudio\VisualStudio\src\GitHub.Api\LoginManager.cs:line 335 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at GitHub.Api.LoginManager.<LoginViaOAuth>d__14.MoveNext() in D:\a\VisualStudio\VisualStudio\src\GitHub.Api\LoginManager.cs:line 158 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at GitHub.VisualStudio.ConnectionManager.<LogInViaOAuth>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at GitHub.ViewModels.Dialog.LoginTabViewModel.<LoginToHostViaOAuth>d__56.MoveNext() in D:\a\VisualStudio\VisualStudio\src\GitHub.App\ViewModels\Dialog\LoginTabViewModel.cs:line 173 {"message":"Requires authentication","documentation_url":"https://docs.github.com/rest/reference/users#get-the-authenticated-user"} 2020-08-15 22:31:05.818 [20420] EROR [05] GitHubServiceProvider Error loading GitHub.Services.IConnectionManager System.InvalidOperationException: Due to high risk of deadlock you cannot call GetService from a background thread in an AsyncPackage derived class. You should instead call GetServiceAsync (without calling Result or Wait on the resultant Task object) or switch to the UI thread with the JoinableTaskFactory.SwitchToMainThreadAsync method before calling GetService. at Microsoft.VisualStudio.Shell.AsyncPackage.GetService(Type serviceType) at Microsoft.VisualStudio.Shell.Package.System.IServiceProvider.GetService(Type serviceType) at GitHub.VisualStudio.GitHubServiceProvider.TryGetService(Type serviceType) 2020-08-15 22:34:32.192 [20420] EROR [01] LoginTabViewModel Error logging into '"https://github.com/"' as '' Octokit.AuthorizationException: Requires authentication at Octokit.Connection.HandleErrors(IResponse response) at Octokit.Connection.<RunRequest>d__58.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Octokit.Connection.<Run>d__571.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at GitHub.Api.LoginManager.d__23.MoveNext() in D:\a\VisualStudio\VisualStudio\src\GitHub.Api\LoginManager.cs:line 346
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at GitHub.Api.LoginManager.d__22.MoveNext() in D:\a\VisualStudio\VisualStudio\src\GitHub.Api\LoginManager.cs:line 335
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at GitHub.Api.LoginManager.d__14.MoveNext() in D:\a\VisualStudio\VisualStudio\src\GitHub.Api\LoginManager.cs:line 158
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at GitHub.VisualStudio.ConnectionManager.d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at GitHub.ViewModels.Dialog.LoginTabViewModel.d__56.MoveNext() in D:\a\VisualStudio\VisualStudio\src\GitHub.App\ViewModels\Dialog\LoginTabViewModel.cs:line 173
{"message":"Requires authentication","documentation_url":"https://docs.github.com/rest/reference/users#get-the-authenticated-user"}

@YounesCheikh
Copy link

I solved the problem using the solution i posted here : Issue 2527 👍

@ttaylor29
Copy link

Another solution:

#2527 (comment)

@Premier-Solutions
Copy link

The issue that I was facing was that github was redirecting me to localhost without adding the port number.
http://localhost/?browser_session_id=96cee3401f9a78b6f307eb0819606d4f80e21988a8a945fb6d3b9b74e032de8e&code=90255ccef1a34eac35cb&state=189a50d1-b1ae-405d-8b46-ecf54e3528a1

I just added the port number as mentioned in ttaylor29 (42549) comment and it worked fine then.

@jcansdale
Copy link
Collaborator

Hi folks 👋🏻

Thanks for reporting the issue with the missing port number. This has been fixed and should now be working correctly!

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

No branches or pull requests

7 participants