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 @dropin/server (Node-only) can use it.

// server-only — never bundle this into a browser build
import { DropInServer } from '@dropin/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 '@dropin/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
},
})