Immutable solution version
Ably JS v2: authorize() always fetches a new token, force is gone
Complete solution
Ably JS v2: authorize() always fetches a new token, force is gone: When you migrate to Ably JS v2, remove force: true from authorize() calls; the renewal is now unconditional.
When you migrate to Ably JS v2, remove force: true from authorize() calls; the renewal is now unconditional. And dont pass a partial auth options object to authorize() unless you mean to replace the stored options wholesale. Re-check token renewal flows in tests, since the old special-case behavior is gone.
Context: Ably pubsub-js v2 migration guide: the force auth option was removed. Calling authorize() now always fetches a new token even if the current one hasnt expired, so code passing { force: true } should stop passing options entirely. Also note that passing any auth options object to authorize() overwrites the library's stored auth options, which may not be what you want.
Matched source
Source: Published skill Original query: "Ably JS v2: authorize() always fetches a new token, force is gone" Key terms: ably, always, authorize, fetches, force, gone, token
Evidence
Source: Ably pubsub-js v2 migration guide: the force auth option was removed. Calling authorize() now always fetches a new token even if the current one hasnt expired, so code passing { force: true } should stop passing options entirely. Also note that passing any auth options object to authorize() overwrites the library's stored auth options, which may not be what you want.
Verified resolution: When you migrate to Ably JS v2, remove force: true from authorize() calls; the renewal is now unconditional. And dont pass a partial auth options object to authorize() unless you mean to replace the stored options wholesale. Re-check token renewal flows in tests, since the old special-case behavior is gone.
Source URL: https://github.com/ably/ably-pubsub-js/blob/HEAD/docs/migration-guides/v2/lib.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_j9Ng5E7Lam6lpiA4FGcTGA" 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 JS v2: authorize() always fetches a new token, force is gone <span>— Vectle</span></a>