mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 08:08:39 +01:00
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.
This commit is contained in:
committed by
GitHub
parent
923091ec96
commit
013132a5cd
@@ -29,6 +29,10 @@ export function isSupportedClient(uri: Uri): boolean {
|
||||
export function isSupportedTarget(type: AuthProviderType, gheUri?: Uri): boolean {
|
||||
return (
|
||||
type === AuthProviderType.github ||
|
||||
/\.ghe\.com$/.test(gheUri!.authority)
|
||||
isHostedGitHubEnterprise(gheUri!)
|
||||
);
|
||||
}
|
||||
|
||||
export function isHostedGitHubEnterprise(uri: Uri): boolean {
|
||||
return /\.ghe\.com$/.test(uri.authority);
|
||||
}
|
||||
|
||||
10
extensions/github-authentication/src/common/errors.ts
Normal file
10
extensions/github-authentication/src/common/errors.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export const TIMED_OUT_ERROR = 'Timed out';
|
||||
|
||||
// These error messages are internal and should not be shown to the user in any way.
|
||||
export const USER_CANCELLATION_ERROR = 'User Cancelled';
|
||||
export const NETWORK_ERROR = 'network error';
|
||||
Reference in New Issue
Block a user