UnrecognizedClientException AWS Origin: Platform & cloud Last updated 13 Oct 2026

UnrecognizedClientException: The security token included in the request is invalid

The access key or session token isn’t recognised — wrong/deleted key, a session token missing for temporary credentials, or a region not enabled for the account.

Exact message you may see The security token included in the request is invalid
Seen on: AWS

Meaning

Temporary credentials need all three values (key ID, secret, session token). Copying only two, using deleted keys, stale environment variables overriding the profile, or calling an opt-in region that isn’t enabled all produce this.

Common causes

  • AWS_SESSION_TOKEN missing or stale for temporary keys
  • Access key deleted/deactivated
  • Old env vars overriding ~/.aws profile
  • Opt-in region not enabled

⚡ Quick fix

  1. Check identity: aws sts get-caller-identity
  2. Unset stale AWS_* env vars or refresh them
  3. Enable the region in Account settings if opt-in

Detailed fix by platform

Shell

  1. bash
    env | grep ^AWS_
    unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
    aws sts get-caller-identity --profile prod

How to diagnose

  1. Credentials — Where are they coming from (env, profile, role)?
  2. Token — Session token present?
  3. Region — Opt-in region?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

401 — HTTP 401 Unauthorized (HTTP)401AADSTS50076 — Azure AD (Entra ID): AADSTS50076 / AADSTS50079 — multi-factor authentication required (Azure)AADSTS50076AADSTS50126 — AADSTS50126: Error validating credentials due to invalid username or password (Azure)AADSTS50126AADSTS700016 — Azure AD (Entra ID): AADSTS700016 Application not found in the directory (Azure)AADSTS700016auth/invalid-credential — Firebase Auth: auth/invalid-credential (auth/wrong-password, auth/user-not-found, auth/invalid-login-credentials) (Authentication)auth/invalid-credenti…Authentication failed — fatal: Authentication failed for 'https://github.com/x/y.git/' (Git)Authentication failedbad auth : Authentication failed — MongoDB: MongoServerError: bad auth : Authentication failed (code 8000 / 18) (MongoDB)bad auth : Authentica…Could not load the default credentials — Google Cloud: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started (Google Cloud / Firebase)Could not load the de…Unrecogni…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.