[BUG] awsAuthRefresh is not working properly after upgrade to claude code 2.0
Status Fixed / completed
Maintainer reply ✓ Yes — blois
Workaround ✓ Mentioned in thread ↓
Activity 9 comments · opened Sep 30, 2025 · closed Oct 31, 2025
💡 Likely answer: A maintainer (blois, collaborator)
responded on this thread — see the highlighted reply below.
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
awsAuthRefresh used to run only when the credentials have become stale in earlier version, right now it is running everytime a new session is started in the terminal.
In the case of the new VSCode extension, it is straight up broken and throws an error.
What Should Happen?
Claude code TUI app should try to authenticate only once with the command provided in the config.
Claude code VSCode extension should be able to execute awsauthrefresh command
Error Messages/Logs
Error found in vscode extension: SyntaxError: Unexpected token 'A', "Attempting"... is not valid JSON
No errors in TUI but it runs the command everytime a new session is opened
Steps to Reproduce
Configure awsAuthRefresh variable in your settings.json with a command like "aws sso login"
and try opening claude code either in terminal or the new vscode plugin
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
1.x
Claude Code Version
2.0.1
Platform
AWS Bedrock
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
9 Comments
I would like to include
awsCredentialExportto this, as I guess they work pretty similarsame issue. had to revert
I've also run into this issue on windows.
What seems to be happening is when you run the command "aws sso login --profile profile-name"
the text
"Attempting to automatically open the SSO authorization page in your default browser.
If the browser does not open, open the following URL:
{url}
"
gets printed to the console. The extension seems to want that to be json, which it isn't. I've tried some work arounds, like "aws sso login --profile profile-name --output json" or "aws sso login --profile pofile-name 1> /dev/null". The first one does nothing, the second one stops this error from happening but then the extension just seems to hang
I also see this on Windows.
Sometimes it results in
Unexpected token 'A', "Attempting"... is not valid JSONas OP shows, but sometimes it also presents as:I'm running claude code 2.0.5 and the
awsAuthRefreshissue seems to be resolved on my machineIt appears that claude is attempting to run the awsAuthRefresh command (aws sso login --profile <AWS_PROFILE>), which as WSL doesn't generally support launching browser windows causes it to hang silently in the background. In versions 2.0.9 and previous the tool would dump the link out to the console allowing users to auth manually.
A simple work-a-round is that still uses SSO involves using wslu to allow WSL to launch your browser in windows.
The wslu package provides utilities specifically designed to improve the integration between WSL and Windows, including a more robust xdg-open implementation that can leverage Windows applications.
You can explicitly tell xdg-open which browser to use by setting the BROWSER environment variable. This is particularly useful if you have a specific browser installed in your WSL environment or want to use a Windows browser.
Add this line to your ~/.bashrc or ~/.zshrc file for persistence and then source the file:
``` shell
source ~/.bashrc
Found a potential workaround.
To get the v1 CLI behavior for this we had to set up the rule like so to maintain the session across claude instances and also to not rely on the AWS CLI cache for session status we had to remove the cache before checking token validity in case of token expiration
a. If token is valid, skip
b. If token is invalid, go through SSO flow
Version
2.0.30of the extension should now display the output of this command, allowing navigation to links which are emitted.This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.