---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/api/errors/51114#article
headline: "51114: Twilsock: Invalid access token header"
url: https://www.twilio.com/docs/api/errors/51114
inLanguage: en
dateModified: 2026-06-09T11:00:42.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# 51114: Twilsock: Invalid access token header

Log Level: ERROR

## Description

Twilio rejected the Access Token used to authenticate a client connection because the token header is invalid. This error usually means the token is malformed, signed incorrectly, or not encoded as a valid JSON Web Token.

### Possible causes

* The value sent as the Access Token is not a valid JWT
* The token header is not valid Base64URL-encoded JSON
* The token is missing a required header value such as `alg` or `typ`
* The token was altered, truncated, or corrupted before it was sent to Twilio
* Your application generated the token with the wrong library or with incompatible signing settings
* The request is sending a different credential instead of a Twilio Access Token

### Possible solutions

* Generate a new Twilio Access Token using an official Twilio helper library
* Verify that the token contains three dot-separated JWT segments for header, payload, and signature
* Decode the token and confirm the header is valid JSON and includes expected values such as `alg` and `typ`
* Confirm that your application signs the token with the correct API Key and API Key Secret for your Twilio account
* Make sure the token is passed to the client exactly as generated, without added whitespace, truncation, or URL encoding issues
* If you create tokens manually, compare your implementation against the Twilio Access Token format used for client-side SDK authentication
* Test the token structure with a JWT inspection tool before sending it to Twilio

#### Additional resources

* [Access Tokens](/docs/iam/access-tokens)
* [Identity and Access Management](/docs/iam)
