20102: Invalid Access Token header
API
ERROR
This error occurs when the header of the Access Token sent to a Twilio API does not meet Twilio's expected format/values for a JWT header.
Twilio Access Tokens are JWTs whose header must include the fields typ, alg, and cty with specific required values. If these are missing or incorrect, the token will be rejected.
- The Access Token header does not contain the required
typfield with valueJWT. - The Access Token header uses an unsupported signing algorithm (e.g., anything other than
HS256) in thealgfield. - The Access Token header omits the
ctyfield or sets it to a value other thantwilio-fpa;v=1.
- Regenerate the Access Token using a Twilio SDK
AccessTokenhelper to ensure the header is formed correctly, then serialize withtoJwt(). - Verify the header fields and values before issuing tokens:
- Set
typtoJWT. - Set
algtoHS256. - Set
ctytotwilio-fpa;v=1.
- Set