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.
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.
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
* 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
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.
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
1. Namespace secrets based on the value of github-enterprise.uri to support "multiple separate GHES instances"
2. If the setting value disappears, continue using last set value. Fixes https://github.com/microsoft/vscode-pull-request-github/issues/3992
3. Mark github-enterprise.uri as requires trust
3. Refactoring like:
* UriHandler is handled in extension.ts and passed down everywhere since we can only have 1 instance of it
* misc style (`private` usage, better `disposable` handling)
The callback provided to the map call on this array should return a value, otherwise map will always return an array of undefined values. If the desired behaviour is to just iterate through all elements, then consider using forEach or a for-of loop instead.