Launch offer for the first 500 accounts: $10K MTR free for 24 months + $100 credit →
    .io

    JWT Templates

    Your claims, in our token

    A JWT template merges claims you define into the session token BillDog issues. It is how you make a BillDog session acceptable to something that expects its own shape — a third-party API, a database's row-level security, a legacy service that reads a particular claim.

    Applying one

    Set it once, on the client — not per call.

    Code
    const auth = createBillDogAuth({
      apiKey: 'bd_public_live_…',
      jwtTemplate: 'supabase',
    });

    A template name that matches nothing yields the ordinary token, never an error. An authoring mistake degrades the claims; it cannot stop anyone signing in.

    Reserved claims are refused at save

    A template may not define any claim BillDog owns. The rejection happens when you save the template, not silently at mint time, so you find out while you are looking at it:

    Code
    iss  sub  sid  aud  exp  iat  nbf  jti
    fva  sts  env  ent  ent_truncated  cus  trs  o  act

    The rule is enforced twice — at save and again at mint — so a template that somehow reached storage with a reserved name still cannot override a platform claim.

    Custom token lifetime

    A template may set ttlSeconds, between 30 seconds and 24 hours. Anything outside that range is refused at save.

    The default of 90 seconds is short on purpose: a verified token proves it was valid when issued, not that the session is still live, so the token's lifetime is exactly the window in which a revoked session still passes offline verification. A 24-hour token means a sign-out can take up to a day to bite. Lengthen it only for a consumer that genuinely cannot refresh, and prefer introspect() where you need certainty.

    Two ways to manage templates

    DoorAuthenticates withFor
    DashboardYour signed-in session, owner or adminAuthoring by hand — Project Settings → Auth → JWT templates
    manage-jwt-templatesA project secret keyScripting, CI, infrastructure-as-code

    Preview before you ship

    The dashboard offers a preview that renders a template against a sample session, so you can see the claim set a consumer will actually receive. Use it — a template is one of the few things here whose mistakes are invisible until a third-party service starts rejecting your users' tokens.

    Next

    Was this page helpful?

    Or rate this page:

    We use cookies and process your data to provide our services. By continuing, you agree to our Terms and Privacy Policy.