Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/microsoft-authentication/src/common/env.ts
3320 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
import { Uri } from 'vscode';
6
7
export const DEFAULT_REDIRECT_URI = 'https://vscode.dev/redirect';
8
9
const VALID_DESKTOP_CALLBACK_SCHEMES = [
10
'vscode',
11
'vscode-insiders',
12
// On Windows, some browsers don't seem to redirect back to OSS properly.
13
// As a result, you get stuck in the auth flow. We exclude this from the
14
// list until we can figure out a way to fix this behavior in browsers.
15
// 'code-oss',
16
'vscode-wsl',
17
'vscode-exploration'
18
];
19
20
export function isSupportedClient(uri: Uri): boolean {
21
return (
22
VALID_DESKTOP_CALLBACK_SCHEMES.includes(uri.scheme) ||
23
// vscode.dev & insiders.vscode.dev
24
/(?:^|\.)vscode\.dev$/.test(uri.authority) ||
25
// github.dev & codespaces
26
/(?:^|\.)github\.dev$/.test(uri.authority) ||
27
// localhost
28
/^localhost:\d+$/.test(uri.authority) ||
29
// 127.0.0.1
30
/^127\.0\.0\.1:\d+$/.test(uri.authority)
31
);
32
}
33
34