feat(auth): add console credentials sign-in option to login webview - #8401
Conversation
|
be60aee to
fa6a4a3
Compare
| const profilePattern = /^[a-zA-Z0-9_-]+$/ | ||
| return this.profileName.length <= 0 || !this.selectedRegion || !profilePattern.test(this.profileName) | ||
| }, | ||
| preventInvalidChars(event: KeyboardEvent) { |
There was a problem hiding this comment.
curious, will this get trigger for copy-paste operation?
There was a problem hiding this comment.
Great catch. I just tested and confirmed paste bypass character restrictions into the profile name field. I will add input validation regardless of input method. Thank you!
| } else if (this.app === 'AMAZONQ') { | ||
| this.selectedLoginOption = LoginOption.BUILDER_ID | ||
| } else if (this.app === 'TOOLKIT') { | ||
| this.selectedLoginOption = LoginOption.ENTERPRISE_SSO |
There was a problem hiding this comment.
Won't this be a breaking change? If so, should we call this out in the change log?
There was a problem hiding this comment.
I agree we should document this noticeable UX change. I'll add another changelog entry for the change in the default pre-selection .
We already have a changelog for the overall console credentials feature here.
| export enum LoginOption { | ||
| NONE, | ||
| BUILDER_ID, | ||
| CONSOLE_CREDENTIAL, |
There was a problem hiding this comment.
There was a problem hiding this comment.
Thanks for catching this type safety. I will add 'auth_consoleCredentialsOption' to the AuthUiClick type union.
| :isSelected="selectedLoginOption === LoginOption.CONSOLE_CREDENTIAL" | ||
| :itemId="LoginOption.CONSOLE_CREDENTIAL" | ||
| :itemText="'Use credentials from the AWS Console'" | ||
| :itemTitle="'Console credentials - recommended'" |
There was a problem hiding this comment.
Nit: It would be nice if there was a way that 'recommended' could be a smaller font. Like how we have 'new' in some places of the console, but it's not the same size or color as the regular text. This is not blocking or anything, just might be nice as a follow-up.
There was a problem hiding this comment.
Thanks for the suggestion on following existing AWS Console UI patterns. We can use the existing itemSubTitle prop.
I'll update the console credentials option to use itemSubTitle="'recommended'" instead of appending it to the title.
| if (this.shouldDisableIamContinue()) { | ||
| return | ||
| } | ||
| this.previousStage = this.stage |
There was a problem hiding this comment.
Do we need previousStage set for when this.stage === 'SSO_FORM'?
There was a problem hiding this comment.
We currently only use previousStage to show the correct authenticating message for console credentials vs IAM flows. I will add that to SSO_FORM for consistency. Thank you!
| @@ -0,0 +1,4 @@ | |||
| { | |||
| "type": "Feature", | |||
| "description": "AWS Toolkit login webview now pre-selects Console credentials (previously Enterprise SSO) as the recommended authentication option. xisting Enterprise SSO users are unaffected and can still select their preferred authentication method." | |||
There was a problem hiding this comment.
Nit: 'xisting' -> 'Existing'
There was a problem hiding this comment.
Thanks for catching this!
58703a6 to
9252253
Compare
| return this.profileName.length <= 0 || this.accessKey.length <= 0 || this.secretKey.length <= 0 | ||
| }, | ||
| shouldDisableConsoleSessionContinue() { | ||
| const profilePattern = /^[a-zA-Z0-9_-]+$/ |
There was a problem hiding this comment.
Thanks for the feedback. I tried time-boxing making/importing profile pattern as a constant. It led to Vue rendering issues:
- Direct imports and data() prevented Vue from rendering
- setup() caused crashes during profile input validation
- Inline regex pattern is more reliable with Vue's reactivity system
Sagemaker IAM profile here also uses inline regex. I will revert constant commit in favor of inline pattern validation.
…, underscore, and hyphen are allowed
7dca5d3 to
6305d79
Compare
8db0e6d to
a4acd6d
Compare
52f40c2
into
aws:feature/console-session-profile
…ws#8401) ## Problem Users can use a beginner-friendly interface to authenticate with AWS Console credentials to obtain temporary credentials, especially for new AWS users. This GUI-based offers alternative to `aws login` command-line authentication. Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sign-in.html ## Solution - Add "Console credentials - recommended" option to login webview - Restrict profile name input to alphanumeric, underscore, and hyphen characters (following [profile name pattern](https://github.com/keenwilson/aws-toolkit-vscode/blob/89739bc176c28321f64cd672664014d1ddfed533/packages/core/src/auth/consoleSessionUtils.ts#L48)) - Show "Opening AWS sign-in in your default browser..." during authentication - Redirect to explorer view upon successful sign-in Note: - The UI flow follows the same pattern as IAM credentials setup, with these key differences: - Console credentials form takes profile name and region (optional) - IAM credentials form takes access key and secret key - Different telemetry emitted for credential source ID: - Console credentials: 'consoleCredentials' - IAM credentials: 'sharedCredentials' - Telemetry for credential source ID is tracked via aws/aws-toolkit-common#1108 - AWS CLI returns exit code 255 if browser-based authentication is not completed, this prevents partial/incomplete authentication states - Reuse `fromLoginCredentials` provider instance to prevent multiple credential resolution attempts and maintain consistent refresh behavior at [resolveProviderWithCancel](https://github.com/aws/aws-toolkit-vscode/blob/eb11eb59318ab83a1f609e472eab760ea38201d1/packages/core/src/auth/providers/sharedCredentialsProvider.ts#L256) in sharedCredentialsProvider ## UI Changes - Added "Console credentials - recommended" as first option in login selection <img width="1122" height="633" alt="1-start" src="https://github.com/user-attachments/assets/3d46b1ee-9730-4834-ac64-328a5b92227c" /> - Created profile name input with validation for letters, numbers, - and _ - Made region selection optional with us-east-1 default <img width="1122" height="631" alt="4-console-profile" src="https://github.com/user-attachments/assets/f1acfffb-40b6-4f7e-a87a-96da6b0ff59d" /> - Shows clear guidance during browser authentication flow <img width="1150" height="765" alt="Opening AWS sign-in in your default browser." src="https://github.com/user-attachments/assets/9f04fea4-0980-4eef-9b3f-e5c2caa9fbc5" /> - Attempt to update AWS CLI if the version < 2.32.0 <img width="1086" height="710" alt="Screenshot 2025-12-11 at 4 31 17 PM" src="https://github.com/user-attachments/assets/77cbc5b6-b238-4db1-bc21-d178081bc298" /> ### Known Issue: Windows PATH Environment After AWS CLI Installation When installing or updating AWS CLI v2 through the toolkit on Windows machine within a managed enterprise or workspace environment, the installation may appear successful, but users receive the error: ``` [error] aws.toolkit.auth.consoleLogin: Error: Failed to verify or install AWS CLI [CliInstallFailed] -> Error: Could not verify installed CLIs ``` This typically occurs because the installer successfully places the necessary files in the default directory (`C:\Program Files\Amazon\AWSCLIV2\`), but security policies or user permissions within the workspace prevent the installer from correctly or immediately updating the system's PATH environment variable. The command prompt doesn't know where to look for the `aws.exe` file. You can verify the installation using the full path and contact your IT support to add the installation path (`C:\Program Files\Amazon\AWSCLIV2\`) to the System variables `PATH` environment variable. ```powershell "C:\Program Files\Amazon\AWSCLIV2\aws.exe" --version ``` --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

Problem
Users can use a beginner-friendly interface to authenticate with AWS Console credentials to obtain temporary credentials, especially for new AWS users. This GUI-based offers alternative to
aws logincommand-line authentication.Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sign-in.html
Solution
Note:
fromLoginCredentialsprovider instance to prevent multiple credential resolution attempts and maintain consistent refresh behavior at resolveProviderWithCancel in sharedCredentialsProviderUI Changes
Known Issue: Windows PATH Environment After AWS CLI Installation
When installing or updating AWS CLI v2 through the toolkit on Windows machine within a managed enterprise or workspace environment, the installation may appear successful, but users receive the error:
This typically occurs because the installer successfully places the necessary files in the default directory (
C:\Program Files\Amazon\AWSCLIV2\), but security policies or user permissions within the workspace prevent the installer from correctly or immediately updating the system's PATH environment variable. The command prompt doesn't know where to look for theaws.exefile.You can verify the installation using the full path and contact your IT support to add the installation path (
C:\Program Files\Amazon\AWSCLIV2\) to the System variablesPATHenvironment variable.feature/xbranches will not be squash-merged at release time.