For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
ReferenceGuidesClick-to-Call
ReferenceGuidesClick-to-Call
  • Core
    • Overview
  • SignalWire Client
    • Overview
    • Notifications
    • Client
      • Address Namespace
      • Chat Namespace
      • Conversation Namespace
        • connect
        • dial
        • disconnect
        • getSubscriberInfo
        • offline
        • online
        • updateToken
    • Utility functions
  • Video
    • Overview
    • LocalOverlay
    • RoomSession
    • RoomSessionDevice
    • RoomSessionPlayback
    • RoomSessionRecording
    • RoomSessionScreenShare
    • RoomSessionStream
    • RoomDevice
    • RoomScreenShare
  • Chat
    • Overview
    • Client
    • ChatMember
    • ChatMemberEntity
    • ChatMessage
    • ChatMessageEntity
  • PubSub
    • Overview
    • Client
    • PubSubMessage
  • WebRTC
    • Overview
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • updateToken
SignalWire ClientClientMethods

updateToken

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

Utility functions

Next
Built with

updateToken

  • updateToken(token: string): Promise<void>

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

token
stringRequired

The new token that the client should start to use.

Returns

Promise<void>

Returns empty object when successful. Throws an error with the server’s error message when unsuccessful.

Example

1import { SignalWire } from "@signalwire/js";
2
3async function main() {
4 const client = await SignalWire({
5 token: "<TOKEN>",
6 onRefreshToken: () => {
7 let newToken = refreshToken(); // this function should refresh token as per OAuth2 protocol
8 client.updateToken(newToken);
9 },
10 });
11}