Skip to content

Authentication & tokens

dropin never sees a password or an OAuth flow: your backend is the identity provider. It signs a short-lived HS256 JWT locally with your tenant’s api_secret — zero network calls to dropin to mint one — and hands that token to the client. apiSecret must never reach the browser; only @dropinnodex/server (Node-only) can use it.

// server-only — never bundle this into a browser build
import { DropInServer } from '@dropinnodex/server'
const server = new DropInServer({
tenantId: process.env.DROPIN_TENANT_ID!,
apiKey: process.env.DROPIN_API_KEY!,
apiSecret: process.env.DROPIN_SIGNING_SECRET!,
url: 'https://api.getnodex.cloud',
})
// Inside your own token endpoint, after you've authenticated the caller yourself:
const token = await server.createUserToken(userId, { expiresIn: '1h' }) // max 24h

expiresIn accepts "30s", "15m", "1h", "1d"-style strings and is capped at 24 hours — a longer value throws before a token the gateway would reject is even minted.

There’s no client- or react-side equivalent: minting requires apiSecret, which only ever lives on your server.

The client (and the React provider wrapping it) never holds apiSecret — only a tokenProvider callback that fetches a token from your own backend endpoint. tokenProvider is called once on init and again on a 401, not per request (spec §9).

import { DropInClient } from '@dropinnodex/client'
const client = new DropInClient({
url: 'https://api.getnodex.cloud',
apiKey: process.env.NEXT_PUBLIC_DROPIN_API_KEY!,
tokenProvider: async () => {
const res = await fetch('/api/token')
const { token } = await res.json()
return token
},
})

Tokens are signed offline, so there is nothing to “delete” — a token stays valid until it expires. Revocation is how you cut one short: it is recorded server-side and enforced from the next request onward, so a token already sitting in a browser stops working immediately.

await server.revokeUserTokens(userId)

Call this on logout, on a ban, or when an account is compromised. It invalidates all of that user’s outstanding tokens, not one specific token.

This is also why the 24h TTL ceiling is an upper bound rather than a recommendation: short tokens shrink the window in which a leaked one is useful, and revocation covers the rest.

  • Limits — token TTL ceiling and the per-tenant rate limits every authenticated request charges.
  • Data security — what we store, where, and why we never hold your users’ credentials.
  • Server SDK reference — every option on DropInServer, generated from the typings.