51116: Twilsock: Invalid access token grants
ERROR
Twilsock could not accept the Access Token because the token grants are invalid. This error usually means the token does not include the product grant your client SDK requires, the grant payload is malformed, or the token was generated with values that do not match your Twilio configuration.
- The Access Token is missing a required grant for the SDK or product you are using, such as Chat, Conversations, Sync, or Notify.
- The grant object in the token payload is malformed or uses unsupported fields.
- The token was generated with an incorrect API Key SID, API Key secret, Account SID, or service identifier.
- The client is using a token created for a different Twilio product or environment than the one the application is connecting to.
- The token payload is valid JWT syntax, but the
grantsclaim does not contain the expected Twilio grant structure.
- Generate a new Access Token on your server and ensure it includes the correct Twilio grant for the client SDK you are using.
- Verify that your token generation code uses the correct Account SID, API Key SID, API Key secret, and any product-specific service or endpoint identifiers.
- Check the token payload and confirm the
grantsclaim includes the expected grant type and required properties for your application. - If you recently changed products or services, make sure the client receives a freshly generated token that matches the current configuration.
- Validate the token structure before returning it to the client. If you inspect the JWT during troubleshooting, do not expose production secrets or private signing material.
- Review the setup guidance for the Twilio product your client connects to and update your token generation logic to match that product's requirements.