[Solved] an Error Occurred (UnauthorizedException) When Calling ListAccounts Operation: Session Token Not Found or Invalid

  • Home /
  • Blog Posts /
  • [Solved] An error occurred (UnauthorizedException) when calling ListAccounts operation: Session token not found or invalid

If you are using aws configure sso to populate your ~/.aws/credentials file and you get the following error when you try and reauthorize, then you can solve this problem as follows:

An error occurred (UnauthorizedException) when calling ListAccounts operation: Session token not found or invalid

Step 1 – Logout from SSO

aws sso logout

Step 2 – Reconfigure SSO with previous defaults

aws configure sso