Troubleshooting "Your authorization token has expired" error


When authenticating to AWS, you may run into an issue where the error Your authorization token has expired is being returned. This issue can arise when stale credentials are being used for authentication.


  • Solution - Removing cached configuration files
    • Two likely sources of this error are the Docker config.json and/or AWS credentials files when cached or persisted on a self-hosted runner. 

      You can add run the following code snippet at the beginning of your job to remove these files.

      - run:
          name: Remove config and credential files
          command: |
            if [ -f "$HOME/.docker/config.json" ]; then
              rm -f ~/.docker/config.json
            if [ -f "$HOME/.aws/credentials" ]; then
              rm -f ~/.aws/credentials

      Following that, you can then proceed to authenticate by using a command such as the aws-ecr orb's ecr-login command.


The stored credentials will be cleared, and you can then authenticate via the aws cli with the correct credentials.

Additional Resources:

Was this article helpful?
0 out of 2 found this helpful



Article is closed for comments.