Update an expired token

A request that uses an expired token fails with 403 Token is expired. The request is not retried automatically. You must set a new token, reconnect, and retry.

Before you start​

Confirm you have:

Steps​

  1. Detect the 403 Token is expired response on the client.
  2. Request a new token from your server.
  3. Set the new token on the client using setToken. See Initialize a client SDK with an auth key for the call in your SDK.
  4. Call reconnect() on the PubNub client. The method name may vary across SDKs.
  5. Retry the failed request.
Reconnect is required

Setting a new token alone is not enough. The client must call reconnect() after setting the token, or subsequent requests may still fail.

Was this page useful?

Last updated on