API key request fails with 401 "Invalid JWT serialization: Missing dot delimiter(s)"
Issue
A request to a Fusion API endpoint, such as a query profile or query pipeline endpoint, is rejected with an HTTP 401 Unauthorized response from the proxy. The request uses a valid Fusion API key. The error message reads:
Invalid JWT serialization: Missing dot delimiter(s)
This can happen with newly created and existing API keys.
Environment
- Fusion 5.x / Managed Fusion
- Requests that authenticate with a Fusion API key
Cause
The API key is being sent in the Authorization: Bearer header.
Fusion treats any value in the Authorization: Bearer header as a signed session token (a JSON Web Token, or JWT). A JWT has three parts separated by dots: header.payload.signature. A Fusion API key is a single string, not a JWT. When Fusion tries to read the API key as a JWT, it can't find the dot separators, so it rejects the request before the API key is checked.
Resolution
-
Remove the
Authorizationheader from the request. -
Send the API key in the
x-api-keyheader:curl -H "x-api-key: YOUR_API_KEY" "https://FUSION_HOST/api/apps/APP_NAME/query/QUERY_PROFILE?q=test"Fusion also accepts the API key as an
apiKeyquery parameter:curl "https://FUSION_HOST/api/query/status?apiKey=YOUR_API_KEY"See API Keys for the full list of ways to pass an API key.
-
Make sure no other part of your client, SDK, or an intermediate proxy adds an
Authorizationheader. -
Send the request again.
Notes
- Use the
Authorization: Bearerheader only for real JWTs issued for a configured JWT security realm. Don't use it for Fusion API keys. - A 401 with a different error, for example a plain
"error": "unauthorized"response and no JWT message, has a different cause, such as a missingapikeyrealm on clusters created before Fusion 5.6.0. See the API Keys documentation for details. - If the request still fails after you move the key to the
x-api-keyheader and remove theAuthorizationheader, contact support.