*** id: e60aebc3-2eb9-45b0-917f-24c707f655e6 title: updateToken slug: /js/reference/signalwire/client/update-token description: updateToken method for the SignalWire Client. max-toc-depth: 3 ---------------- ### updateToken * **updateToken**(`token`: `string`): `Promise` Update the auth token being used by the client. Use this when the old token is about to expire and you have refreshed it through OAuth2. #### Parameters The new token that the client should start to use. #### Returns `Promise` Returns empty object when successful. Throws an error with the server's error message when unsuccessful. #### Example ```javascript import { SignalWire } from "@signalwire/js"; async function main() { const client = await SignalWire({ token: "", onRefreshToken: () => { let newToken = refreshToken(); // this function should refresh token as per OAuth2 protocol client.updateToken(newToken); }, }); } ```