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

GitHub Authentication: Sign in failed: Error: No auth flow succeeded #195286

Closed
axosoft-ramint opened this issue Oct 10, 2023 · 5 comments · Fixed by #195527
Closed

GitHub Authentication: Sign in failed: Error: No auth flow succeeded #195286

axosoft-ramint opened this issue Oct 10, 2023 · 5 comments · Fixed by #195527
Assignees
Labels
authentication Issues with the Authentication platform bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@axosoft-ramint
Copy link

axosoft-ramint commented Oct 10, 2023

  • VS Code Version: 1.83.0
  • OS Version: Windows 10 64-bit

The GitHub Auth extension is running into an issue with CORS, which results in an error when authenticating.

Devtools yields the following logs:

Access to fetch at 'https://github.com/login/oauth/access_token' from origin 'https://v--15coekdin4scjauo9v5fvhbspk3mi3ftteagqn81g3pkn9368ma8.vscode-cdn.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
webWorkerExtensionHostIframe.html:1 Access to fetch at 'https://github.com/login/oauth/access_token' from origin 'https://v--15coekdin4scjauo9v5fvhbspk3mi3ftteagqn81g3pkn9368ma8.vscode-cdn.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
webWorkerExtensionHostIframe.html:1 Access to fetch at 'https://github.com/login/oauth/access_token' from origin 'https://v--15coekdin4scjauo9v5fvhbspk3mi3ftteagqn81g3pkn9368ma8.vscode-cdn.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Sign in failed: Error: No auth flow succeeded.

Requirements:

  1. Must be authing with GitHub authentication without having a stored secret i.e. without a previously successful auth (can reset this with Developer: Reset User Data from the Command Palette).
  2. Have an extension loaded which uses GitHub Auth (I used GitLens).

Steps to Reproduce:

  1. Open github.dev to a repo, or whatever action triggers the GitHub auth flow for an extension.
  2. See The extension ____ wants to sign in using GitHub modal. click Allow.
  3. See error notification showing: Sign in failed: Error: No auth flow succeeded.

Update: The auth seems to work fine on vscode.dev; only able to reproduce the issue in github.dev.

image

@axosoft-ramint
Copy link
Author

axosoft-ramint commented Oct 10, 2023

Follow-up: In case it is helpful/relevant, I am able to get around the issue by doing the following:

  1. Hit Cancel on the initial auth prompt.

image

  1. Grant access to the extension from the sidebar instead.

image

  1. Hit Allow on the new auth prompt.

image

  1. The auth is successful.

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Oct 13, 2023

@axosoft-ramint @eamodio what's the API call you make to getSession? I expected you to go to the Grant option first... it's unusual that the modal popped up the way that it did.

TylerLeonhardt added a commit that referenced this issue Oct 13, 2023
Fixes #195286

If the auth provider doesn't support multiple accounts and we have a valid session and the user consented, then use that session.
@TylerLeonhardt
Copy link
Member

I have a potential fix for this... though, I'm a little suspicious of it. Can you try with github.dev targeting Insiders tomorrow?

@TylerLeonhardt TylerLeonhardt added bug Issue identified by VS Code Team member as probable bug authentication Issues with the Authentication platform labels Oct 13, 2023
@TylerLeonhardt TylerLeonhardt added this to the October 2023 milestone Oct 13, 2023
TylerLeonhardt added a commit that referenced this issue Oct 13, 2023
Fixes #195286

If the auth provider doesn't support multiple accounts and we have a valid session and the user consented, then use that session.
@vscodenpa vscodenpa added the unreleased Patch has not yet been released in VS Code Insiders label Oct 13, 2023
@eamodio
Copy link
Contributor

eamodio commented Oct 13, 2023

We call getSession in a few ways depending on the scenario. In this case because we are trying to work with a "virtual" GitHub folder/repo, we need the authentication to work at all, so we use createIfNone.

@vscodenpa vscodenpa added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Oct 13, 2023
meganrogge pushed a commit that referenced this issue Oct 13, 2023
Fixes #195286

If the auth provider doesn't support multiple accounts and we have a valid session and the user consented, then use that session.
@axosoft-ramint
Copy link
Author

Verifying that the issue no longer occurs for me when using the Insiders version. Thank you! 👍🏼

@TylerLeonhardt TylerLeonhardt added the verified Verification succeeded label Oct 13, 2023
Alex0007 pushed a commit to Alex0007/vscode that referenced this issue Oct 26, 2023
Fixes microsoft#195286

If the auth provider doesn't support multiple accounts and we have a valid session and the user consented, then use that session.
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
authentication Issues with the Authentication platform bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants