Skip to main content

Custom JWT Integration

If you already have an authentication system that issues JWTs (Auth0, Firebase Auth, Supabase Auth, Clerk, or a custom backend), you can use the custom_jwt auth method to connect it to Privacy Boost. Your backend validates the user’s identity with your auth provider and forwards a JWT to Privacy Boost, which verifies it via your JWKS endpoint.

How It Works

Custom JWT Authentication Flow

Server-Side Setup

Your app must be configured with the custom_jwt auth method. Contact the Privacy Boost team with:
  • JWKS URL — The HTTPS endpoint serving your JSON Web Key Set (e.g., https://your-auth.com/.well-known/jwks.json). Privacy Boost fetches this to verify JWT signatures.
  • Audience — Required expected aud claim in your JWTs. Only tokens with a matching audience are accepted.
  • Issuer — Required expected iss claim in your JWTs. Only tokens with a matching issuer are accepted.
The backend configuration looks like:

JWT Requirements

Your JWT must:
  • Be signed with RS256, RS384, RS512, ES256, ES384, or ES512
  • Include a kid (Key ID) header matching a key in your JWKS
  • Include a sub or user_id claim identifying the user
  • Include an exp claim and be valid (not expired)
  • Match the configured aud and iss

Client-Side Integration

1. Configure Privacy Boost for Direct IdP Auth

Browser IdP callbacks are only supported in local key-vault mode. The default browser mode is the isolated iframe vault, which intentionally does not accept host-page token callbacks.

2. Provide the External JWT

For browser apps, pass getExternalToken. It returns the raw JWT from Auth0, Firebase, Supabase, Clerk, or your own auth system. The SDK attaches it to both Privacy Boost auth requests.

Optional: Backend Token Provider

Use tokenProvider instead when your backend must perform the Privacy Boost token exchange itself. Do not pass both tokenProvider and getExternalToken.

3. Pass Native Token Providers to authenticate()

4. Implement the Backend Endpoint

Your backend endpoint receives the SDK’s login payload, attaches your JWT, and forwards to Privacy Boost:

Testing

For development, you can use app_id_only to skip the token provider entirely. Switch to custom_jwt when moving to production.

Next Steps

Continue with setup: Or explore other auth methods:
  • Privy — For Privy social login and embedded wallets
  • Dynamic — For Dynamic wallet connection and embedded wallets
  • API Secret — For server-to-server with client credentials