@trueyy-sdk/node

Tokens

Mint short-lived browser JWTs per round and role.

Session tokens let you embed <TrueyyJoin> / <TrueyyMonitor> in your own UI without a Trueyy login. Each token is scoped to one round and one role and expires in ~5 minutes.

tokens.mint(roundId, role)

const { token, expires_at, role } = await trueyy.tokens.mint(
  round_id,
  "candidate"   // "candidate" | "interviewer" | "helper"
);

roundId is the round's session id - from interviews.createround_id, interviews.addRoundround_id, or an interview's rounds[].id.

Which token goes where

RoleHand it to
candidateThe candidate's pre-join page (<TrueyyProvider><TrueyyJoin>).
interviewerThe interviewer's monitoring page (<TrueyyProvider><TrueyyMonitor>).
helperThe candidate's local Helper, via @trueyy-sdk/web-core's helperJoin.

Refreshing

Mint a fresh token whenever the previous one nears expiry. The browser client calls back to your backend to fetch one via this method, through the onTokenExpiring handler on <TrueyyProvider>:

<TrueyyProvider
  token={sessionJwt}
  onTokenExpiring={async () => {
    const res = await fetch("/our-ats/refresh-trueyy-token");
    return res.text();   // your backend calls trueyy.tokens.mint(round_id, role)
  }}
>

See Authentication for the security rationale.

On this page

Ask ChatGPT