Commit Graph

192 Commits

Author SHA1 Message Date
Copilot
b2590e0b22 Fix FetcherService retrying with multiple fetchers on 429 and other application errors (#282100)
* Initial plan

* Fix FetcherService to not retry with other fetchers on 429 status code

Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>

* Improve test robustness based on code review feedback

Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
2025-12-10 01:57:09 +00:00
Tyler James Leonhardt
55d06aa3a1 Add a log for the url (#282098)
so it's clear what fails. We saw rate limiting from GH EDU.
2025-12-08 16:51:11 -08:00
Paul
55cdeb5771 Add prefer device flow config for GitHub auth (#271838)
* Initial plan

* Add forceDeviceCodeFlow setting for GitHub authentication

Co-authored-by: pwang347 <8560030+pwang347@users.noreply.github.com>

* modifications

* nit

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pwang347 <8560030+pwang347@users.noreply.github.com>
2025-10-17 00:06:01 +00:00
Tyler James Leonhardt
8845fc4b5c Remove any casts in auth extensions (#270089) 2025-10-06 12:28:27 -07:00
Matt Bierner
360c9fd134 Add lint rule for as any and bulk ignore all existing breaks
For #269213

This adds a new eslint rule for `as any` and `<any>({... })`. We'd like to remove almost all of these, however right now the first goal is to prevent them in new code. That's why with this first PR I simply add `eslint-disable` comments for all breaks

Trying to get this change in soon after branching off for release to hopefully minimize disruption during debt week work
2025-10-02 23:38:33 -07:00
Tyler James Leonhardt
2deaa78bcf Add /login/oauth path part to the ghes supported authorization server (#265703)
Fixes GHE MCP loading
2025-09-08 17:38:49 +00:00
Christof Marti
f5f2ea58fc Rerun fallbacks (#260297) 2025-09-08 16:55:43 +02:00
Tyler James Leonhardt
71b461ab86 Support PKCE for GitHub Auth (#265381)
Fixes https://github.com/microsoft/vscode/issues/264795
2025-09-05 19:55:35 +02:00
Christof Marti
7be2a0b2e6 Retry with first fetcher to avoid fallback on resume 2025-09-04 21:42:15 +02:00
Benjamin Pasero
d44d16c464 Wire in a auth callback parameter to indicate Copilot terms were shown to the user (microsoft/vscode-internalbacklog#5761) (#262439)
* implement as a bag

* nit

---------

Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
2025-08-22 14:42:25 +09:00
Christof Marti
5bf6e4d607 Fall back to alternate fetch implementation (#262181) 2025-08-19 04:46:22 -07:00
Tyler James Leonhardt
d3c3cf8f50 Attempt to fix Codespaces bug by declaring a default (#261484)
Fixes https://github.com/microsoft/vscode/issues/261238
2025-08-13 16:44:28 +00:00
Copilot
97bc9a439c Fix GitHub Authentication reload dialog appearing unnecessarily in remote tunnel scenarios (#261257) 2025-08-12 09:47:23 -07:00
Tyler James Leonhardt
631a4d9dbb Workaround electron proxy issues for GitHub by allowing to switch to node's fetch (#261099)
A user reported that their proxy ZScaller has issues with Electron's fetch. More research needs to be done to understand why this is not playing nice wholistically...

... but, to unblock GitHub scenarios like Copilot, we add this setting to change the implementation of fetch used.

At some point, we need to have http.useElectronFetch setting be enabled by default and when that happens, this setting can be removed in favor of that.

cc @chrmarti @alexdima
2025-08-11 18:39:45 +00:00
Benjamin Pasero
2188c90df5 Add sign in option for Apple (microsoft/vscode-internalbacklog#5578) (#255155) 2025-07-10 14:43:10 -07:00
Tyler James Leonhardt
b1e40f2893 Revert "Use Code OSS GitHub client id" (#252559) 2025-06-26 18:04:50 -07:00
Tyler James Leonhardt
8d05b579cc Use Code OSS GitHub client id (#252426)
To separate Code OSS & VS Code.
2025-06-25 18:58:58 +02:00
Tyler James Leonhardt
51eba2dc05 Support provider parameter in device code flow (#251767)
Not lit up on the server side, but should be ready in the next day or so.
2025-06-18 03:20:41 +02:00
Tyler James Leonhardt
559c2fa308 Use provider query parameter (#251662)
The identity team are gonna take this direction instead.
2025-06-17 18:06:36 +02:00
Tyler James Leonhardt
2fabac413d Introduce auth-provider specific props & use it for social sign in for GitHub (#251649)
ref https://github.com/microsoft/vscode/issues/251648

NOTE: the server side is not quite ready. It doesn't redirect back to VS Code properly, but this should be good to go whenever that is.
2025-06-16 23:02:36 +02:00
Tyler James Leonhardt
9cbcaa893f Bring in branding when built (#251451)
* Bring in branding when built

Since we shouldn't have "Visual Studio Code" in this OSS repo.

* fix test
2025-06-13 16:41:29 -07:00
Tyler James Leonhardt
31620a3dec Have Loopback Server flow redirect back to VS Code and make it the primary flow (#251333)
* Have Loopback Server flow redirect back to VS Code and make it the primary flow

Fixes https://github.com/microsoft/vscode/issues/250086

* Fix test

* Fix test

* Fix other test
2025-06-13 08:14:41 +02:00
Tyler James Leonhardt
89fbfc20ab Fix race condition in unregistering authentication providers (#250667)
A minimal change for endgame.
2025-06-04 13:35:13 -07:00
Tyler James Leonhardt
c235626145 issuer -> authorizationServer refactor (#250359)
* `issuer` -> `authorizationServer` refactor

Also:
* adds `authorizationServerGlobs` to the authentication contribution schema
* removes ugly MCP issuer hack and instead plumbs the authorizationServer down to the new auth providers
2025-06-02 17:38:21 -07:00
Tyler James Leonhardt
86efdcd2c1 Introduce Issuer handling in the Authentication stack (#248948)
Mostly plumbing... this enables:
```
vscode.authentication.getSession('microsoft', scopes, { issuer: "https://login.microsoftonline.com/common/v2.0" });
```
And the respective API for an auth providers to handle it being passed in.

This props up work in MCP land which needs a way to map an issuer to an auth provider... but I certainly see utility outside of that space.

Fixes https://github.com/microsoft/vscode/issues/248775#issuecomment-2876711396
2025-05-14 23:02:15 +02:00
Tyler James Leonhardt
a1d4a24624 Register a NullAuthProvider for github-enterprise when there is no setting set (#248870)
This should help in some cases where extensions call getSession to get github-enterprise and end up waiting 5 seconds for it to time out because it use to only be registered when there was a setting set.
2025-05-13 16:24:14 -07:00
Tyler James Leonhardt
b2224f2fc6 Improve logic for detection of node vs web worker extension host (#248534)
* Use `WorkerGlobalScope` instead of `navigator` since node defines `navigator` now

* microsoft auth too

* better logic
2025-05-09 19:37:27 +02:00
Tyler James Leonhardt
9ca1204521 Doc calling out GitHub OAuth client secret behavior (#242210) 2025-02-27 18:47:41 +01:00
Devraj Mehta
87ed97df8b Use Electron fetch or Node fetch for github-authentication to support proxies (#238149)
* Attempt to use Electron fetch for github-authentication

Also changes fallback from node-fetch to the built-in Node fetch

* Remove Content-Length header Electron compatibility

It looks like it was set incorrectly to the body contents anyways.
2025-01-17 19:05:10 +00:00
Tyler James Leonhardt
950b401a9c Make multiple accounts the default (#231618) 2024-10-18 01:36:06 +02:00
Tyler James Leonhardt
6d482e38cd No longer look at sessions[0] (#231063)
We don't need to do this anymore now that account preference is kept across sessions.
2024-10-10 14:50:19 -07:00
Tyler James Leonhardt
52b0ec07b8 Allow Multi-account in GitHub Auth in Insiders (#229106) 2024-09-20 00:31:40 +02:00
Tyler James Leonhardt
c4d1cc2e67 Fix GitHub account ids being numbers (#228045)
For a long time the account id wasn't handled correctly. It should be a string, but the API returns a number. This ensures it's a string and does some migration logic.
2024-09-10 04:39:37 +02:00
Tyler James Leonhardt
04bcb01ddf Move 'incorrect account' handling into core (#224872)
So that all auth providers can take advantage of this logic. This basically will do a light enforcement that the account you signed in to matches the account that was requested (if it was specified).

This is needed for finalization.
2024-08-05 12:45:11 -07:00
Matt Bierner
84607a2fe2 Fix some always true/false errors in codebase (#223359)
* Fix some always true/false errors in codebase

Testing out latest TS nightly that can identify when an expression is always true/false. This caught a few likely coding mistakes in our codebase

Unsure about the intent in some of these cases but I've tried my best to understand them. Pinging relevant code owners for the confusing cases

* Bump TS version

* Fix unreachable in build scripts

* Bump versions

* restore intent

* Revert package.json change

* Fixing a few new layer checker errors

These are global in node now

* Skip lib check in integration project

* One more skiplibcheck

* More skip lib

---------

Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>
2024-07-30 15:37:27 -07:00
Tyler James Leonhardt
3873c58c47 If the setting value is the same, do nothing (#223518)
It seems like this event fires in Codespaces... my _guess_ is that Codespaces basically overwrites all the settings from settings sync which causes this event to fire.

It's surprising to me that this event fires even though the value hasn't changed.

I can't repro this with the test resolver, and I also cant have Codespaces use Code - OSS, so we'll just have to see how this goes.

This _should_ do the trick though.

Fixes https://github.com/microsoft/vscode/issues/223508
2024-07-24 10:11:27 -07:00
Tyler James Leonhardt
ba98397575 Experimental GitHub Multi-account support (#222131)
* Have select account picker include accounts that don't match requested scopes (this will run `createSession` for that chosen account)
* Implement multi-account GitHub support behind a setting
2024-07-19 14:48:40 -07:00
Tyler James Leonhardt
1b24381b5c Adopt getAccounts API in GitHub Authentication (#221224)
This allows the GitHub Auth provider to take in a account per this proposal:

417dddb83f/src/vscode-dts/vscode.proposed.authGetSessions.d.ts (L35-L69)

Additionally, this makes an additional small change that allows `clearSessionPreference` to work in single-account auth providers.
2024-07-09 00:19:40 +02:00
Tyler James Leonhardt
9d4274e559 Remove session if it is being replaced (#212504)
A bug that has probably existed for quite a while... if we are replacing a session, we should say the old session is removed.
2024-05-11 14:49:03 +02:00
Tyler James Leonhardt
dc45ddef95 Remove requirement that there can be only one account (#212398)
This allows each set of scopes to have one account associated with it.
2024-05-09 15:59:58 -07:00
Tyler James Leonhardt
cd6bd0a01a Bug fix: check account id not session id (#206990)
This should be checking the account id not the session id... otherwise the user will get a modal every time they go through the login flow.
2024-03-06 19:02:46 +01:00
Tyler James Leonhardt
191be39e5a Make sure the same GitHub account is used until we support multiple GH accounts (#206847)
Fixes https://github.com/microsoft/vscode/issues/203850
2024-03-04 15:01:51 -08:00
Tyler James Leonhardt
482d5ba393 Add some integration tests for github-auth (#195729) 2023-10-16 13:58:44 -07:00
Tyler James Leonhardt
5134662139 Remove CredentialsService & keytar (#192224)
* Remove CredentialsService & keytar

ref https://github.com/microsoft/vscode/issues/115215
fixes https://github.com/microsoft/vscode/issues/143395

* compile

* remove imports

* rip the bandaid
2023-09-05 17:47:30 -07:00
Tyler James Leonhardt
eec2fc723c Disable Local Server flow for REH (#191930)
Because spinning up ports on the remote won't always work. Instead, we have the trusty device code flow.

Fixes https://github.com/microsoft/vscode/issues/191866
Fixes https://github.com/microsoft/vscode/issues/191867
2023-08-31 22:10:26 +02:00
Tyler Leonhardt
ac27273e48 Try to revoke tokens that are getting deleted
Best effort.

Fixes https://github.com/microsoft/vscode/issues/152055
2023-07-17 14:12:10 -07:00
Tyler James Leonhardt
013132a5cd Re-work auth flows into separate file (#186939)
The flows are crucial to the extension and I wanted to be able to declare which can be used when in a declarative way. This reworks the flows into that model.

Additionally, it pulls in the Client ID and secret from a config which will allow us to not rely on the vscode.dev proxy on Desktop (because we can make a distro change that includes the secret... which isn't a real secret, says GitHub)... unfortunately we still need to rely on it for Web due to CORS but we're in a position where it will be easy to rip the proxy out when GH supports it.
2023-07-03 15:06:42 -07:00
Tyler James Leonhardt
f9b4b4c6a3 Pass session down so we can avoid a network call (#181570)
We don't need to fetch the user details when the Auth Session already has the info we need. This PR removes that extraneous web request.

I've also changed the `User-Agent` that we pass to be more specific so we can narrow down any future issues with spamming web requests.

Fixes #173645
2023-05-04 11:59:25 -07:00
Tyler James Leonhardt
738ab7954c Add mode to the notification (#180977)
ref https://github.com/microsoft/vscode/issues/180803#issuecomment-1522947472
2023-04-26 23:16:39 +02:00
Tyler James Leonhardt
1714f71c41 Organize Errors in GitHub Auth and make sure no double prompting happens (#180734)
* Organize Errors in GitHub Auth and make sure no double prompting happens

This mostly just moves some strings into variables... but this also fixes the GH Auth side of https://github.com/microsoft/vscode/issues/180697 so you should only be asked once if you want to try a different way to log in.

* add comments
2023-04-24 12:59:03 -07:00