-
Notifications
You must be signed in to change notification settings - Fork 15
SSO session expiration and re-login #531
Description
Describe the bug
I'm using AWS SSO to authenticate and aws-sdk-js-v3. When the SSO session expires it tells me to log in again with an error message, but even after repeating the aws sso login, the credentials still don't work.
Expected Behavior
The Node server is able to load credentials again and I can keep developing.
Current Behavior
The error message persists.
Reproduction Steps
- I log in normally using
aws sso login --profile developer - I start my Node.js server:
AWS_PROFILE=developer node server.js - I keep developing my app until my SSO session expires
- aws-sdk-js-v3 throws an error:
CredentialsProviderError: The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile
- I login again
aws sso login --profile developer - Same error is thrown again when I try to call some aws-sdk-js-v3 command.
Possible Solution
No response
Additional Information/Context
I opened my .aws/sso/cache/xxx.json file and notice that the accessToken is updated however the expiresAt property is not updated even after a new aws sso login call.
If I wait more time and run aws sso login again it finally updates the expiresAt property.
It seems that this is a likely reason for the issue I'm having. It seems like there is some mismatch with different expirations.
CLI version used
aws-cli/2.8.2 Python/3.10.7 Darwin/21.6.0 source/arm64 prompt/off
Environment details (OS name and version, etc.)
MacOS