Skip to content

Commit 1c2e6e4

Browse files
fix device auth
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
1 parent b1729ca commit 1c2e6e4

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

code/extensions/che-github-authentication/src/device-authentication.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import * as vscode from 'vscode';
1515
import { ExtensionContext } from './extension-context';
1616
import { GitHubAuthProvider, GithubService } from './github';
1717
import { CHANNEL_NAME, Logger } from './logger';
18+
import { DEVICE_AUTH_SCOPES } from './utils';
1819

1920
@injectable()
2021
export class DeviceAuthentication {
@@ -54,7 +55,7 @@ export class DeviceAuthentication {
5455
}
5556

5657
async trigger(): Promise<string | undefined> {
57-
const scopes = ['user:email'];
58+
const scopes = [...DEVICE_AUTH_SCOPES];
5859
this.logger.info(`Device Authentication is triggered for scopes: ${scopes.join(' ')}`);
5960

6061
try {

code/extensions/che-github-authentication/src/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ export function sessionMatchesRequestedScopes(sessionScopes: readonly string[],
4242
return hasAllScopes([...sessionScopes], [...requestedScopes]);
4343
}
4444

45+
/** Matches product.json defaultChatAgent.providerScopes[0] and Copilot GITHUB_SCOPE_ALIGNED. */
46+
export const DEVICE_AUTH_SCOPES = ['read:user', 'user:email', 'repo', 'workflow'] as const;
47+
4548
/** Scope bundles used by Copilot / github / GHPRI / Agent Host — session keys match vanilla createSession. */
4649
export const HYDRATION_SCOPE_BUNDLES: readonly string[][] = [
4750
['read:user', 'user:email', 'repo', 'workflow', 'project', 'read:org'],

0 commit comments

Comments
 (0)