5
5
6
6
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
7
7
import { AuthStatus } from 'aws-core-vscode/telemetry'
8
- import { AwsConnection , Connection , AuthUtils } from 'aws-core-vscode/auth'
8
+ import { AwsConnection , Connection , SsoConnection , AuthUtils } from 'aws-core-vscode/auth'
9
9
import { activateExtension , getLogger } from 'aws-core-vscode/shared'
10
10
import { VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
11
11
@@ -15,6 +15,7 @@ export async function getAuthStatus() {
15
15
const authState = ( await AuthUtil . instance . getChatAuthState ( ) ) . codewhispererChat
16
16
let authEnabledConnections = AuthUtils . getAuthFormIdsFromConnection ( AuthUtil . instance . conn )
17
17
let authStatus : AuthStatus = authState === 'connected' || authState === 'expired' ? authState : 'notConnected'
18
+ let authScopes : string [ ] = ( AuthUtil . instance . conn as SsoConnection ) ?. scopes ?? [ ]
18
19
19
20
// If the Q extension does not have its own connection, it will fallback and check
20
21
// if the Toolkit extension can provide a connection that works with Q
@@ -33,10 +34,11 @@ export async function getAuthStatus() {
33
34
// Though TS won't say it, AwsConnection sufficiently overlaps with Connection for the purposes
34
35
// of `getAuthFormIdsFromConnection`
35
36
authEnabledConnections = AuthUtils . getAuthFormIdsFromConnection ( autoConnectConn as unknown as Connection )
37
+ authScopes = autoConnectConn . scopes ?? [ ]
36
38
}
37
39
}
38
40
39
- return { authStatus, authEnabledConnections : authEnabledConnections . join ( ',' ) }
41
+ return { authStatus, authEnabledConnections : authEnabledConnections . join ( ',' ) , authScopes : authScopes . join ( ',' ) }
40
42
}
41
43
42
44
/**
0 commit comments