---
source_url: https://www.pubnub.com/docs/security/access-control/update-expired-token
title: Update an expired token
updated_at: 2026-09-30T07:20:08.000Z
---

# Update an expired token

> For AI agents: documentation index at https://www.pubnub.com/llms-full.txt

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:

* A server endpoint that grants new tokens on request. See [Grant, change, and revoke permissions](https://www.pubnub.com/docs/security/access-control/manage-permissions.md).
* A client initialized with an `authKey`. See [Initialize a client SDK with an auth key](https://www.pubnub.com/docs/security/access-control/initialize-client-sdk.md).

## 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](https://www.pubnub.com/docs/security/access-control/initialize-client-sdk.md#update-the-token-after-initialization) 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.

:::warning 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.
:::

## Related pages

* [Change or extend access](https://www.pubnub.com/docs/security/access-control/change-or-extend-access.md). Proactive strategies for refreshing tokens before they expire.
* [Initialize a client SDK with an auth key](https://www.pubnub.com/docs/security/access-control/initialize-client-sdk.md). `setToken` reference and initialization code.
* [Grant, change, and revoke permissions](https://www.pubnub.com/docs/security/access-control/manage-permissions.md). Issue a new token from your server.

Last updated at: 2026-09-30T07:20:08.000Z
