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 thecustom_jwt auth method to connect it to Privacy Boost. Your auth system signs the user in and issues a JWT; the SDK sends that JWT to Privacy Boost as part of sign-in, and Privacy Boost verifies it against your JWKS endpoint.
How It Works
Server-Side Setup
Your app must be configured with thecustom_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
audclaim in your JWTs. Only tokens with a matching audience are accepted. - Issuer — Required expected
issclaim in your JWTs. Only tokens with a matching issuer are accepted.
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
suboruser_idclaim identifying the user - Include an
expclaim and be valid (not expired) - Match the configured
audandiss
Client-Side Integration
1. Configure Privacy Boost for Direct IdP Auth
In a browser,getExternalToken only works with the local key vault. The default browser key vault runs in an isolated iframe, which can’t call back into your page, so passing getExternalToken there throws. Set keyVault: { mode: 'local' }:
2. Provide the External JWT
PassgetExternalToken to signIn. It returns the raw JWT from Auth0, Firebase, Supabase, Clerk, or your own auth system. The SDK sends it on both the /auth/login bootstrap and the /auth/token exchange, so it’s called more than once per sign-in and should return a cached token rather than mint a new one each time.
externalToken argument of signIn instead.
Relaying the login through your own backend (
tokenProvider) isn’t supported yet.Testing
For development, an app on App ID only auth signs in without an external token. Switch the app to custom JWT for production.Next Steps
Continue with setup:- Key Management — Configure key persistence for returning users
- Error Handling — Handle auth and operation errors
- Privy — For Privy social login and embedded wallets
- Dynamic — For Dynamic wallet connection and embedded wallets
- API Secret — For your own servers: the Backend API and the CLI