@videosdk.live/server-sdk
    Preparing search index...

    Class AccessTokenBuilder

    Fluent builder for VideoSDK access tokens.

    By default it builds a participant token (for joining a room). Call AccessTokenBuilder.forApi for a server-side management token.

    const token = vsdk.accessToken()
    .setParticipant("user-123")
    .grant(Grant.AllowJoin, Grant.AllowMod)
    .forRoom("2kyv-gzay-64pg")
    .expiresIn("15m")
    .toJwt();
    Index
    • Token lifetime — seconds (number) or a duration string like "15m", "24h".

      Parameters

      • duration: string | number

      Returns this

    • Build a server-side management/API token instead of a participant token.

      Returns this

    • Scope the token to a specific room (roomId claim).

      Parameters

      • roomId: string

      Returns this

    • Add one or more permission grants.

      Parameters

      • ...grants: string[]

      Returns this

    • Attach an arbitrary custom claim.

      Parameters

      • key: string
      • value: unknown

      Returns this

    • Set the participantId claim.

      Parameters

      • participantId: string

      Returns this

    • Sign and return the JWT.

      Returns string