Skip to content

feat(auth): add console credentials sign-in option to login webview - #8401

Merged
ashishrp-aws merged 16 commits into
aws:feature/console-session-profilefrom
keenwilson:feature/console-session-profile
Dec 12, 2025
Merged

feat(auth): add console credentials sign-in option to login webview#8401
ashishrp-aws merged 16 commits into
aws:feature/console-session-profilefrom
keenwilson:feature/console-session-profile

Conversation

@keenwilson

@keenwilson keenwilson commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

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)
  • 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 telemetry: Add console login as valid credential source ID 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 in sharedCredentialsProvider

UI Changes

  • Added "Console credentials - recommended" as first option in login selection
1-start
  • Created profile name input with validation for letters, numbers, - and _
  • Made region selection optional with us-east-1 default
4-console-profile
  • Shows clear guidance during browser authentication flow
Opening AWS sign-in in your default browser.
  • Attempt to update AWS CLI if the version < 2.32.0
Screenshot 2025-12-11 at 4 31 17 PM

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.

"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.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@keenwilson
keenwilson requested a review from a team as a code owner December 9, 2025 07:37
@github-actions

github-actions Bot commented Dec 9, 2025

Copy link
Copy Markdown
  • This pull request modifies code in src/* but no tests were added/updated.
    • Confirm whether tests should be added or ensure the PR description explains why tests are not required.
  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

@keenwilson
keenwilson force-pushed the feature/console-session-profile branch 4 times, most recently from be60aee to fa6a4a3 Compare December 9, 2025 08:28
const profilePattern = /^[a-zA-Z0-9_-]+$/
return this.profileName.length <= 0 || !this.selectedRegion || !profilePattern.test(this.profileName)
},
preventInvalidChars(event: KeyboardEvent) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious, will this get trigger for copy-paste operation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example: pasting " 11:24 AM" will show as "1124AM" profile name.

clean invalid characters

} else if (this.app === 'AMAZONQ') {
this.selectedLoginOption = LoginOption.BUILDER_ID
} else if (this.app === 'TOOLKIT') {
this.selectedLoginOption = LoginOption.ENTERPRISE_SSO

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this be a breaking change? If so, should we call this out in the change log?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

recommended label

if (this.shouldDisableIamContinue()) {
return
}
this.previousStage = this.stage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need previousStage set for when this.stage === 'SSO_FORM'?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: 'xisting' -> 'Existing'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

@keenwilson
keenwilson force-pushed the feature/console-session-profile branch 2 times, most recently from 58703a6 to 9252253 Compare December 10, 2025 02:35
Comment thread packages/core/src/login/webview/vue/toolkit/backend_toolkit.ts Outdated
return this.profileName.length <= 0 || this.accessKey.length <= 0 || this.secretKey.length <= 0
},
shouldDisableConsoleSessionContinue() {
const profilePattern = /^[a-zA-Z0-9_-]+$/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it constant?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/^[a-zA-Z0-9_-]+$/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/core/src/login/webview/vue/toolkit/backend_toolkit.ts
@keenwilson
keenwilson force-pushed the feature/console-session-profile branch from 7dca5d3 to 6305d79 Compare December 11, 2025 00:47
@keenwilson
keenwilson force-pushed the feature/console-session-profile branch from 8db0e6d to a4acd6d Compare December 12, 2025 00:23
@ashishrp-aws
ashishrp-aws merged commit 52f40c2 into aws:feature/console-session-profile Dec 12, 2025
25 checks passed
aws-ajangg pushed a commit to aws-ajangg/aws-toolkit-vscode that referenced this pull request Jan 15, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants