Switch to Tessera from your current sign-in
Keep your app, your pages, your sessions and your users, and point sign-in at Tessera. Auth.js is shown (Next.js; SvelteKit uses the same provider object), and the pattern is the same for any OpenI...
On this page
Keep your app, your pages, your sessions and your users, and point sign-in at Tessera. Auth.js is shown (Next.js; SvelteKit uses the same provider object), and the pattern is the same for any OpenID Connect library: register the app, replace the provider's settings, carry your existing users across, then remove the old provider.
Before you start
tessera versionIf it prints a version, go on. If not, install the CLI with curl -fsSL https://tessera.kurthlabs.ai/install.sh | bash. It checks the download's signature and installs to ~/.local/bin, with no sudo. During early access, the CLI download is by invitation. Ask us for it. Make sure that folder is on your PATH, then run the command again.
1. Create the app in Tessera
tessera initThe first time, it asks you to sign in: open the link it prints and enter the code. Then it registers the app in your realm and writes .env.local. The client secret goes into that file and nowhere else.
2. Change the provider
Whatever sign-in you use today, it is the one provider entry you replace. Here is Google, the most common one:
-import Google from "next-auth/providers/google";
export const { handlers, auth, signIn, signOut } = NextAuth({
- providers: [Google({ clientId: process.env.GOOGLE_ID, clientSecret: process.env.GOOGLE_SECRET })],
+ providers: [{
+ id: "tessera",
+ name: "Tessera",
+ type: "oidc",
+ issuer: process.env.TESSERA_ISSUER,
+ clientId: process.env.TESSERA_CLIENT_ID,
+ clientSecret: process.env.TESSERA_CLIENT_SECRET,
+ }],
});Change signIn("google") (or whatever your old provider's id was) to signIn("tessera") wherever you call it. Other stacks: use the page for your stack (Next.js, SvelteKit, Express, Go, Python); the provider settings are the same three values.
3. Keep your existing users
Tessera gives each user an ID of its own (the sub claim), different from the one your old provider gave. Tessera does not read your old provider's user list, so match returning users on their email address, and only when the ID token says email_verified: true:
- Bring people over in one of two ways. Invite them:
tessera invites create --realm YOUR_REALM --email person@example.com(YOUR_REALMis the last part ofTESSERA_ISSUERin.env.local). Or, if the realm's sign-up policy is open, they just sign in with their email address. - In your sign-in callback, look the user up by
emailand attach the newsubto the record you already have. In Auth.js,signInis where you refuse an unverified email, andjwtis where you store thesub(theprofileargument is the ID token's claims, and is only present on the sign-in itself).findUserByEmailandsaveTesseraSubstand for your own database calls:
// auth.ts: add to the NextAuth({ ... }) options from step 2
callbacks: {
async signIn({ account, profile }) {
if (account?.provider !== "tessera") return true;
// Only a verified email may claim an existing account.
return profile?.email_verified === true && typeof profile.email === "string";
},
async jwt({ token, account, profile }) {
if (account?.provider === "tessera" && profile?.sub && profile.email) {
const user = await findUserByEmail(profile.email); // your old record, by email
if (user) {
await saveTesseraSub(user.id, profile.sub); // from now on, match on sub
token.userId = user.id;
}
}
return token;
},
}, After the first sign-in, look people up by sub and keep email only as the fallback for people who have not signed in yet. That maps each old ID to its new sub the first time the person arrives; there is nothing to prepare in advance.
- Keep your old provider next to Tessera for a while if you want a gradual move.
People sign in to Tessera with a passkey or an emailed code or link (or a password, if the realm has password sign-in turned on). Tessera has no bulk user import and does not import password hashes from another system, so nobody's old password carries over: at their first sign-in they use a passkey or an email link, or set a new password.
4. Remove the old provider
Once everyone has moved, delete the old provider's configuration and keys from your app and your environment (for Google, GOOGLE_ID and GOOGLE_SECRET), and revoke them at the old provider.
Coming from…
Google or other social sign-in
In your app, replace the provider as in step 2. Your users carry over by email: a Google account's verified email is the match, as in step 3.
If you want people to keep using their Google, GitHub, Apple or Microsoft Entra ID (single tenant) account, a realm administrator can connect that provider to the realm, and Tessera's sign-in page then offers it. With auto-link by verified email turned on, someone whose provider email matches an existing Tessera user gets an email asking them to confirm before the two accounts are linked; nothing is linked without that confirmation.
Auth0
Auth0 is an OpenID Connect provider, so in your app it is the same provider swap: the issuer, client id and client secret become Tessera's. Existing users carry over by verified email, as in step 3. Their Auth0 IDs (sub) and passwords stay behind; Tessera cannot import password hashes.
A realm administrator can also connect Auth0 as an upstream provider (tessera federation oidc ensure) so people can still sign in with their Auth0 account for a while. The same confirm-by-email rule applies when linking.
Clerk
Replace Clerk's sign-in components and middleware with your library's OpenID Connect provider, pointed at Tessera. Existing users carry over by verified email, as in step 3. Tessera does not import users or password hashes from Clerk, so people sign in with a passkey, an email link or code, or a new password.
Firebase Auth
Replace the Firebase sign-in calls with your library's OpenID Connect provider, pointed at Tessera, and stop verifying Firebase ID tokens. Existing users carry over by verified email, as in step 3. Firebase's user IDs and password hashes do not move; people sign in with a passkey or an email link, or set a new password.
Amazon Cognito
Cognito is an OpenID Connect provider, so in your app it is the same provider swap. Existing users carry over by verified email, as in step 3. A realm administrator can connect a Cognito user pool as an upstream provider (tessera federation oidc ensure) while people move. Cognito's user IDs and password hashes stay behind.
Your own passwords
Your app currently checks passwords itself. Add the Tessera provider as in step 2, and keep your password form during the move if you like. Match users by email as in step 3, then retire the password form and delete the stored password hashes. Tessera does not import them, so at their first sign-in people use a passkey or an email link, or set a new password.
Environment
tessera init writes these to .env.local:
TESSERA_ISSUER=https://login.kurthlabs.com/realms/YOUR_REALM
TESSERA_CLIENT_ID=YOUR_CLIENT_ID
TESSERA_CLIENT_SECRET=YOUR_CLIENT_SECRET
AUTH_SECRET=YOUR_SESSION_SECRETThe redirect URL registered for this app is http://localhost:3000/api/auth/callback/tessera.