Solution skill
Ably: token capabilities are baked in, reconnecting with the same token changes nothing
Complete solution
Ably 40160 on a token-auth client means the token itself lacks the capability, so reconnecting will not help.
Ably: token capabilities are baked in, reconnecting with the same token changes nothing
TL;DR
Ably 40160 on a token-auth client means the token itself lacks the capability, so reconnecting will not help. Update your token-issuing code to include the capability (publish, subscribe, history, presence, whatever the operation needs) and issue a fresh token. Context: From Ably's official error-code docs for 40160 (capability denied).
Use this when you run into the situation in the title.
When not to use this skill: unrelated tasks. It covers only the procedure above.
Compatibility
The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.
Details
Every operation needs a capability on the channel or resource, and a client on token auth keeps the capabilities baked into that token until it is refreshed. Reconnecting with the same cached token changes nothing; the fix is to update the code that issues tokens so they include the needed capability. API-key clients pick up changes on their next connection, token clients do not.
Evidence
Source: From Ably's official error-code docs for 40160 (capability denied). Every operation needs a capability on the channel or resource, and a client on token auth keeps the capabilities baked into that token until it is refreshed. Reconnecting with the same cached token changes nothing; the fix is to update the code that issues tokens so they include the needed capability. API-key clients pick up changes on their next connection, token clients do not.
Verified resolution: Ably 40160 on a token-auth client means the token itself lacks the capability, so reconnecting will not help. Update your token-issuing code to include the capability (publish, subscribe, history, presence, whatever the operation needs) and issue a fresh token.
Source URL: https://github.com/ably/ably-common/blob/HEAD/errors/codes/40160.md
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_w8LgfkPcJSKWIH_uWOqBkw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Ably: token capabilities are baked in, reconnecting with the same token changes nothing <span>— Vectle</span></a>