Skip to content

Commit 77eb916

Browse files
committed
Use toolkit MFA prompt in Q
1 parent 5acb15e commit 77eb916

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/amazonq/src/lsp/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import { processUtils } from 'aws-core-vscode/shared'
5858
import { activate as activateChat } from './chat/activation'
5959
import { activate as activeInlineChat } from '../inlineChat/activation'
6060
import { AmazonQResourcePaths } from './lspInstaller'
61-
import { auth2 } from 'aws-core-vscode/auth'
61+
import { auth2, getMfaTokenFromUser } from 'aws-core-vscode/auth'
6262
import { ConfigSection, isValidConfigSection, pushConfigUpdate, toAmazonQLSPLogLevel } from './config'
6363
import { telemetry } from 'aws-core-vscode/telemetry'
6464
import { SessionManager } from '../app/inline/sessionManager'
@@ -348,7 +348,7 @@ async function postStartLanguageServer(
348348
client.onRequest(
349349
auth2.notificationTypes.getMfaCode.method,
350350
async (params: GetMfaCodeParams): Promise<GetMfaCodeResult> => {
351-
const mfaCode = await vscode.window.showInputBox({ title: 'Enter MFA Code' })
351+
const mfaCode = await getMfaTokenFromUser(params.mfaSerial, params.profileName)
352352
return { code: mfaCode ?? '' }
353353
}
354354
)

packages/core/src/auth/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export {
2222
} from './connection'
2323
export { Auth } from './auth'
2424
export { CredentialsStore } from './credentials/store'
25+
export { getMfaTokenFromUser } from './credentials/utils'
2526
export { LoginManager } from './deprecated/loginManager'
2627
export * as constants from './sso/constants'
2728
export * as cache from './sso/cache'

0 commit comments

Comments
 (0)