Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

SSO session expiration and re-login #531

@villelahdenvuo

Description

@villelahdenvuo

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

  1. I log in normally using aws sso login --profile developer
  2. I start my Node.js server: AWS_PROFILE=developer node server.js
  3. I keep developing my app until my SSO session expires
  4. 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

  1. I login again aws sso login --profile developer
  2. 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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingservice-apiThis issue pertains to the AWS APIsso

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions