Error code: 40143 - Token unrecognised

This means the token you are providing is not recognised as either an Ably Token, an Ably JWT, or a JWT with a valid Ably Token embedded within it.

If you're creating a JWT, we recommend you use an existing JWT creation library to reduce the possibility of creating tokens incorrectly.

If you're using an Ably Token then it is worth checking that it has the expected format as returned from the requestToken endpoint. It should be in the form:

<appId>.<randomBytes>

Ably Tokens that are not in this format will not be recognised.