From Better Auth
For: a developer whose app runs Better Auth 1.7 and must keep its code and its tables.
What it does: the Better Auth package names point at @authtempo/compat-better-auth. The app’s code then runs on the engine of authtempo, on the app’s own Better Auth tables.
Before you start
Section titled “Before you start”- An app on Better Auth 1.7, on Postgres through postgres.js, on D1, or on a SQLite file through
node:sqliteor better-sqlite3. Better Auth compatibility lists what it keeps. - The tables
user,session,account,verification,organization,member,invitation, andpasskey. Create a missing table with Better Auth’s own SQL for it. The Better Auth tables section lists them. - The packages of authtempo in the pnpm workspace of the repo. Choose your stack tells why.
Export
Section titled “Export”Nothing leaves the database: the app keeps its own tables.
- Back up the database before the move, with
pg_dumpon Postgres. - On D1, back it up with
wrangler d1 export <database> --remote --output backup.sql.
Carry the passwords
Section titled “Carry the passwords”The password rows stay in the account table. Core verifies a Better Auth hash, and rehashes it as PBKDF2 at the first right sign-in.
Dry run
Section titled “Dry run”- List the compat migrations that the database lacks, and apply nothing.
- Add
--before-1.7on D1 or SQLite when the tables are from before Better Auth 1.7. - On SQLite, name the file that holds the Better Auth tables. A missing file stops the command with exit 2.
The @authtempo packages are on npm. Add the CLI to your app with pnpm add -D @authtempo/cli, and run each command as pnpm exec authtempo ….
authtempo migrate --target postgres --url-env DATABASE_URL --tables compat --dry-runauthtempo migrate --target d1 --database <database> --remote --tables compat --dry-runauthtempo migrate --target sqlite --file <path> --tables compat --dry-run- Run the same command without
--dry-run. - On D1, the command copies each compat file of the table below into the app’s
migrations_dir, under the next number. Then it applies them. - On Postgres, the server can call
betterAuthSchemaStorage({ dialect: "postgres", sql }).migrate()once per deploy, before the first request, instead.- On SQLite,
betterAuthSchemaStorage({ dialect: "sqlite", driver }).migrate()does the same.drivercomes from an entry of@authtempo/adapter-sqlite.
- On SQLite,
- In the app’s
package.json, point each Better Auth name that the app imports at the compatibility package.
{ "dependencies": { "better-auth": "npm:@authtempo/compat-better-auth@0.1.0", "@better-auth/drizzle-adapter": "npm:@authtempo/compat-better-auth@0.1.0", "@better-auth/expo": "npm:@authtempo/compat-better-auth@0.1.0", "@better-auth/passkey": "npm:@authtempo/compat-better-auth@0.1.0", "@better-auth/api-key": "npm:@authtempo/compat-better-auth@0.1.0", "@authtempo/core": "0.1.0", "@authtempo/client": "0.1.0", "@authtempo/handoff": "0.1.0", "@authtempo/adapter-d1": "0.1.0", "@authtempo/adapter-postgres": "0.1.0" }}- Keep both adapters in the list, also for an app on one database. The server entry loads both.
Verify
Section titled “Verify”- Run
authtempo check <base url>against the API. - Sign in once with a known user by each method: the password, the magic link, and each social provider.
authtempo check https://api.example.comThe test below runs the sample against a database in memory. It also shows the error at start.
import { BetterAuthCompatError, betterAuth, type CompatDatabase,} from "@authtempo/compat-better-auth";import { createMemoryAdapter, createMemoryLimiter, type StorageAdapter, systemClock,} from "@authtempo/core";import { describe, expect, it } from "vitest";import { API, SECRET } from "../support/harness.ts";import { betterAuthServer } from "./better-auth.ts";
/** A test database: core's memory adapter under the compatibility kind. The app passes its Better Auth tables. */function memoryDatabase(storage: StorageAdapter = createMemoryAdapter()): CompatDatabase { return { kind: "authtempo-compat-database", dialect: "postgres", storage, limiter: createMemoryLimiter(systemClock), };}
// Made on 2026-10-10 by hashPassword of @better-auth/utils 0.4.2, the code of// Better Auth 1.7.2 (the vector of packages/compat-better-auth/test/hash.test.ts).const BETTER_AUTH_HASH = "8b963491c29137940a209e5a26de719e:b4ce8a3b919a25198f84eebbede27d1cd0fda32747c6489f0997b993a16de0a2381351c5595013552488269e72aa6507da171fac50e68ce5ff7173ff58b554d3";
describe("move from Better Auth", () => { it("serves core's routes under /api/auth and mails the verify link of a sign-up", async () => { const mails: { to: string; url: string }[] = []; const auth = betterAuthServer({ database: memoryDatabase(), secret: SECRET, sendMail: async (to, _subject, url) => { mails.push({ to, url }); }, }); const none = await auth.handler(new Request(`${API}/api/auth/session`)); expect({ status: none.status, body: await none.json() }).toEqual({ status: 401, body: { error: "unauthorized" }, });
const up = await auth.api.signUpEmail({ body: { email: "pat@example.com", password: "correct horse battery", name: "Pat" }, }); expect(up.token.startsWith("ts_")).toBe(true); expect(mails.map((m) => m.to)).toEqual(["pat@example.com"]); expect(mails[0]?.url.startsWith(`${API}/api/auth/password/verify?token=pv_`)).toBe(true); });
it("fails at start on an option that core cannot keep, and names it", () => { let error: unknown = null; try { betterAuth({ baseURL: API, secret: SECRET, database: memoryDatabase(), hooks: {} }); } catch (e) { error = e; } expect(error).toBeInstanceOf(BetterAuthCompatError); expect((error as BetterAuthCompatError).refusals.map((r) => r.split(":")[0])).toEqual([ "hooks", ]); });
it("keeps an old password row after the alias, and rehashes it at the first right sign-in", async () => { // The rows of a Better Auth user with a credential account, as the // compatibility storage reads them from the app's tables after the alias. const storage = createMemoryAdapter(); const at = new Date("2026-09-01T00:00:00.000Z"); await storage.create("user", { id: "pat", email: "pat@example.com", emailVerified: true, name: "Pat", image: null, bannedAt: null, banReason: null, banUntil: null, username: null, displayUsername: null, phone: null, isAnonymous: false, createdAt: at, updatedAt: at, }); await storage.create("password", { id: "pat-credential", userId: "pat", hash: BETTER_AUTH_HASH, createdAt: at, updatedAt: at, }); const auth = betterAuthServer({ database: memoryDatabase(storage), secret: SECRET, sendMail: async () => {}, }); const hash = async () => (await storage.findOne("password", [{ field: "userId", op: "eq", value: "pat" }]))?.hash;
await expect( auth.api.signInEmail({ body: { email: "pat@example.com", password: "correct horse batterz" }, }), ).rejects.toMatchObject({ statusCode: 401, body: { code: "INVALID_EMAIL_OR_PASSWORD" } }); expect(await hash()).toBe(BETTER_AUTH_HASH);
const signIn = () => auth.api.signInEmail({ body: { email: "pat@example.com", password: "correct horse battery" }, }); expect((await signIn()).user.id).toBe("pat"); expect((await hash())?.startsWith("pbkdf2-sha256$")).toBe(true); expect((await signIn()).user.id).toBe("pat"); });});Change the calls
Section titled “Change the calls”- Core stores no provider access token (spec 9). So
getAccessTokenhas no answer, and each caller of it breaks at the cutover. Move each call to the provider’s own token flow before the move. - The session cookie is
__Host-tempo_session(plan 12b), and a browser never sends a__Host-cookie to a sibling subdomain. Soadvanced.crossSubDomainCookieshas no map, and an app that shares its session across subdomains breaks at the cutover. - Remove each import of
better-auth/db,better-auth/types, and the access subpaths. The package does not export them. - Start the server once. Read the list of the one
BetterAuthCompatError, and change or remove each option that it names.
import { betterAuth, type CompatDatabase } from "@authtempo/compat-better-auth";
/** * A Better Auth 1.7 server on authtempo. In the app this file imports * `better-auth`, and the package alias answers it with * `@authtempo/compat-better-auth`. The options are Better Auth's own. */export function betterAuthServer(options: { /** `betterAuthSchemaStorage({ dialect: "postgres", sql })` or `drizzleAdapter(db, { provider, schema })`. */ database: CompatDatabase; secret: string; sendMail(to: string, subject: string, url: string): Promise<void>;}) { return betterAuth({ baseURL: "https://api.example.com", secret: options.secret, database: options.database, emailAndPassword: { enabled: true, // Required: core mails a reset link, and the factory refuses a config without this callback. sendResetPassword: async ({ user, url }) => options.sendMail(user.email, "Reset your password", url), }, emailVerification: { // Required: core mails a verify link at every sign-up. sendVerificationEmail: async ({ user, url }) => options.sendMail(user.email, "Verify your address", url), }, });}The account operations of a settings page work on the shim. They need a fresh session for each sensitive change. The account operations lists them and their options. Build an account settings page shows the client calls and the fresh rule.
- Wrap the handler in place of
hooks. Core has no request hooks.
Cut over
Section titled “Cut over”- Do the steps of The cutover.
- Register the new callback URL at each social provider before the cutover.
- With the admin plugin, carry the admins. Core gives operator power by the platform role only, never by Better Auth’s
rolecolumn.- Make one admin the first operator, once, with
auth.tempo.api.operator.createAdminin the app. It makes the platform organization. - Grant the platform role to each other admin with
auth.tempo.api.operator.platformRole.grant, or with/admin/set-rolefrom the first operator’s session. - Ask each admin to sign in again and turn a second factor on. A session from before the grant holds no operator power.
- Skip this step, and each admin loses the admin power at the cutover: each admin call answers 403.
- The
authtempooption takes no operator secret, so the CLI’screate-adminanduserscommands do not reach the app.
- Make one admin the first operator, once, with
The bans of the admin plugin need no step. Compat migration 0009 copies each ban into core’s columns, so a banned user stays banned.
The D1 files
Section titled “The D1 files”| File | What it does |
|---|---|
0001_compat_better_auth.sql |
Adds ta_meta and ta_limit, the ta columns that Better Auth lacks, and the unique keys that core needs. |
0002_compat_schema_v5.sql |
Moves the version to 5. It changes no table. |
0003_compat_schema_v6.sql |
Adds ta_totp and ta_trusted_device. |
0004_compat_schema_v7.sql |
Adds ta_jwk, ta_oauth_client, ta_oauth_consent, and ta_oauth_token. |
0005_compat_schema_v8.sql |
Adds ta_second_factor, copies each enabled ta_totp row, and deletes each setup that no enable confirmed. |
0006_compat_schema_v9.sql |
Adds secret_version to ta_totp, ta_second_factor, and ta_jwk, and taSecretVersion to verification, default 1. Tables with other names take the text of compatMigration0006Sql("sqlite", storage.names). |
0007_compat_schema_v10.sql |
Adds taFreshAt to session, nullable, with no fill. Tables with other names take the text of compatMigration0007Sql("sqlite", storage.names). |
0008_compat_schema_v11.sql |
Adds the version 11 columns to ta_oauth_client and ta_oauth_token, and adds ta_oauth_device, ta_oauth_subject, ta_oauth_session_client, and ta_oauth_logout. The same text for every naming. |
0009_compat_schema_v12.sql |
Adds taBannedAt, taBanReason, and taBanUntil to user and taActorId to session, nullable, and adds ta_operator_audit. It copies each ban of the admin plugin into the three ban columns. Tables with other names take the text of compatMigration0009Sql("sqlite", storage.names). |
0010_compat_schema_v13.sql |
Adds activeTeamId to session and teamId to invitation, nullable, with no fill. Creates Better Auth’s organizationRole when it is absent, and adds taRank (default 1) and the unique key on (organizationId, role). Creates Better Auth’s team and teamMember when they are absent. Adds teamMember.taOrganizationId and taUpdatedAt with a fill, and the unique key on (teamId, userId). Adds core’s ta_api_token, ta_organization_token, and ta_moved_token. The d1-before-1.7 file also adds team.memberCount (default 0) and teamMember.membershipKey (unique), which the team tables of Better Auth 1.4.21 lack. Tables with other names take the text of compatMigration0010Sql("sqlite", storage.names), with "before-1.7" as the third argument for tables from before 1.7. |
0011_compat_schema_v14.sql |
Adds ta_sso_connection, ta_sso_domain, ta_scim_token, ta_scim_user, ta_scim_group, and ta_scim_group_member. It names ta_ tables only. |
0012_compat_schema_v15.sql |
Adds username, displayUsername, phoneNumber, phoneNumberVerified, and isAnonymous (default false) to user, with a unique key on username and on phoneNumber. Adds taDiscoverable, taPrf, and taLargeBlob to passkey. Tables with other names take the text of compatMigration0012Sql("sqlite", storage.names). |
0013_compat_schema_v16.sql |
Adds taProved to session, NOT NULL with the default 0. Sets 1 on each session whose user has a verified address that is not a placeholder. A user with no address signs in again for verified powers. A user with an unverified address proves it first. A verified user’s session that a Worker of core 15 writes after 0013 ends at its next use, so the person signs in again. Tables with other names take the text of compatMigration0013Sql("sqlite", storage.names). |
0014_compat_schema_v17.sql |
Adds ta_sso_setup_link, ta_sso_test_run, and ta_sso_setup_session. Adds draft (default 0), version (default 1), and setup_link_id to ta_sso_connection, setup_link_id to ta_sso_domain, and pending (default 0) and setup_link_id to ta_scim_token. It names ta_ tables only. |
0015_compat_schema_v18.sql |
Adds organization_id to ta_operator_audit. Adds certificate_ends_at, expiry_stage, expiry_notice_at, last_success_at, last_failure_at, and last_failure_step to ta_sso_connection. Adds expiry_stage and expiry_notice_at to ta_scim_token and ta_sso_setup_link. Each new column is nullable with no default. It names ta_ tables only. |
A file number lower than the Better Auth table migration makes every new database fail at the compat file with no such table.
Better Auth’s teams option adds session.activeTeamId and invitation.teamId. SQLite has no ADD COLUMN IF NOT EXISTS, so the shipped 0010 fails on these tables with duplicate column name: activeTeamId. An app with these two columns writes its own 0010 file. It is the shipped file of its directory without its two ALTER TABLE ... ADD COLUMN lines of session and invitation. The other lines must stay. They create the organizationRole, team, and teamMember tables when they are absent. They add taRank, the ta columns, and the unique keys, and move the versions.
The app applies the files to 0009, its own 0010, and the shipped 0011 to 0015 with wrangler d1 migrations apply before authtempo migrate --target d1 --tables compat. Then the compat version is 15, and the command copies nothing. On Postgres, the 0010 adds each column only when it is absent, so no own file is necessary.
Better Auth’s username, phone number, and anonymous plugins add columns that the shipped 0012 adds too. On such tables the shipped 0012 fails with duplicate column name. An app with one of these plugins writes its own 0012 file. It is the shipped file without the ADD COLUMN line of each column that the table holds, and without the unique key that it holds. On Postgres, the 0012 adds each column and each key only when it is absent.
The fill of 0013 on a large database
Section titled “The fill of 0013 on a large database”On D1, the fill of 0013_compat_schema_v16.sql is one statement. It changes one row for each session of a verified user. The Cloudflare D1 limits page, read 2026-11-04, says that a single query that changes hundreds of thousands of rows exceeds the execution limits. It says that a large UPDATE must run in batches. When the fill fails at that limit, the file fails, and the versions stay 15 and 12. Core at version 16 then refuses the database with schema_mismatch.
Run the sweep before the file, so that the expired sessions are gone. Call auth.tempo.api.sweepExpired() once, or wait for its next scheduled run. Then count the sessions of verified users with the first command below. An app with more than 100,000 live sessions of verified users applies 0013 by hand, in pages. The ceiling keeps the one statement of the shipped fill below hundreds of thousands of rows. The steps by hand are the other four commands, in this order, before you deploy core at version 16:
- Add the column. When the column exists already, the command fails with
duplicate column name: taProved. Then go to step 2. - Fill one page of 10,000 sessions. Run the command again until
changesin themetaof its answer is 0. Each page scans the rows that earlier pages marked, about 50 million row reads for a million sessions. - Write version 16 in
ta_meta. - Write the compat version 13 in
ta_meta. With it,authtempo migrate --tables compatcopies no 0013.
wrangler d1 execute my-app --remote --command "SELECT COUNT(*) AS sessions FROM session s JOIN user u ON u.id = s.userId WHERE u.emailVerified = 1 AND u.email IS NOT NULL AND NOT (lower(u.email) LIKE '%@placeholder.invalid' OR lower(u.email) LIKE '%.placeholder.invalid')"wrangler d1 execute my-app --remote --command "ALTER TABLE session ADD COLUMN taProved INTEGER NOT NULL DEFAULT 0"wrangler d1 execute my-app --remote --json --command "UPDATE session SET taProved = 1 WHERE taProved = 0 AND id IN (SELECT s.id FROM session s JOIN user u ON u.id = s.userId WHERE u.emailVerified = 1 AND u.email IS NOT NULL AND NOT (lower(u.email) LIKE '%@placeholder.invalid' OR lower(u.email) LIKE '%.placeholder.invalid') AND s.taProved = 0 LIMIT 10000)"wrangler d1 execute my-app --remote --command "UPDATE ta_meta SET value = '16' WHERE key = 'schema_version'"wrangler d1 execute my-app --remote --command "UPDATE ta_meta SET value = '13' WHERE key = 'compat_better_auth'"The commands use the default names of Better Auth. Tables with other names take the names of compatMigration0013Sql("sqlite", storage.names). The fill skips a placeholder address, as the shipped file does. An app that keeps a copy of 0013 in its migrations_dir marks that copy as applied in d1_migrations, by the name of the copy.
The table prefix ta_ keeps the old product name tempo-auth for compatibility. Schema and migrations states the rule.
Cutover of API tokens
Section titled “Cutover of API tokens”The apiKey plugin maps onto core’s API tokens. Better Auth stores the SHA-256 of the whole key. So moveBetterAuthApiKeys moves each key into core’s token table, and the key keeps working under the same secret. A new key has core’s prefix, tk_ for a user or to_ for an organization. Each step states what breaks without it.
- Before the cutover, copy the database. Apply the compat migrations to the copy:
storage.migrate()on Postgres, or the D1 files withwrangler d1 migrations apply. Without them, the storage refuses the copy withschema_mismatch, and the dry run cannot start. Then runmoveBetterAuthApiKeyswithdryRun: trueagainst the copy. On D1, run it in a Worker with the D1 binding, as the compat package README shows. A stored prefix outsidemovedPrefixes, or a row with no prefix, makes the dry run throwBetterAuthCompatError. The error names each such prefix and counts the rows with no prefix. Do step 2 for each, and run the dry run again. Else the report gives the count of keys per owner and the stored prefixes. Without it, you do not know whom to tell, or which prefixes to list. - Put each stored prefix other than
defaultPrefixinauthtempo.movedKeyPrefixes. Re-issue each key with no prefix, and delete its row. Without it, the move throws before its first write and moves nothing. PassmovedPrefixes: movedKeyPrefixesOf(options)to the move, so it reads the list that core reads. - Tell each owner whose key the report skips.
skippedKeysnames each row id, its owner, and the reason. The reasons aredisabled,expired,noDigest,noCreator,noOwner,invalidName,invalidMetadata, andwideWindow.noDigestis a key with no digest.noCreatoris an organization key with no creator and no owner.noOwneris a key whose user or organization is gone.invalidNameis a name over 80 characters or with a control character.invalidMetadatais metadata over 4096 bytes.wideWindowis a window that core cannot hold without a wider rate. It has a max below 1, or less than one call a day. A key with no name moves with the nameMoved key.presentis a row that an earlier run moved. After the cutover each other skipped key answers 401token_retired, and every script that uses one stops.verifyApiKeyanswersKEY_DISABLEDfor it. - Deploy the shim build with the compat migration 0010. Without the migration, the storage refuses to start with
schema_mismatch. From the deploy to the end of step 5, every old key answers 401token_retired. This gap is an outage of each script with an old key, so keep it short. Run step 5 right after the deploy. - Run
moveBetterAuthApiKeyswithdryRun: false. On D1, run it in a Worker with the D1 binding, as the compat package README shows. It records each moved row inta_moved_token, so a second run skips it, and a revoked key stays revoked. Without it, every old key answerstoken_retiredby its prefix, and the key list shows no row for it. - A resource server with
@authtempo/verifypassesmovedPrefixes, the same list. It passesmovedKind, with that kind inaccept:"api-token"forreferences: "user","organization-token"for"organization". Without them, the verifier answers null for every moved key. A newto_key needs"organization-token"inaccept. - Change the app code that reads the
apikeytable itself, and each check of the old prefix. Without it, a newto_key never authenticates, and the key list shows only the old table. - When every owner moved, drop the
apikeytable yourself. No migration of authtempo drops it, because it is your record. Without the drop, nothing breaks; the table only holds stale rows.
A moved key counts against the cap of 50 live tokens per owner, because it acts.
How it behaves
Section titled “How it behaves”- Better Auth’s defaults apply: a session lives 7 days and refreshes after 1 day.
- The session cookie is
__Host-tempo_session, notbetter-auth.session_token. Change each test and each legal page that names the old cookie. The shim readtempo_session, the name before plan 12b, until 0.2.0, and reads it no more. On Expo,getCookie()answers__Host-tempo_session=<token>, and the storage key keeps the name<storagePrefix>_tempo_session. - The cookie name keeps the old product name tempo-auth for compatibility. Cookies states the rule.
- The one key that is not Better Auth’s is
authtempo.authtempo.appURLis the origin where each sign-in lands, by default the origin ofbaseURL. An absolutecallbackURLoff that origin answers 403 withINVALID_CALLBACK_URL.authtempo.passwordHashreplacesbetterAuthPasswordHash(). session.tokenholds the SHA-256 of the token. App SQL that reads it reads a hash.- A reset ends every session, where Better Auth kept the others.
- Compat 0013 sets
taProvedtrue on each session of a verified user, also on a session that Better Auth made before the proof. Better Auth 1.7.7, read 2026-11-04, ends no session when its email verification link proves an address. So the fill makes no session stronger than before. requireEmailVerification: truemaps topassword.requireVerified. An unverified sign-in answersEMAIL_NOT_VERIFIEDand gets a new verify link, also whensendOnSignInis absent.secrets: [{ version, value }]maps to core’ssecrets. Version 0 is refused: renumber from 1. Withsecret, version 1 must be the value ofsecret. The shim does not readBETTER_AUTH_SECRETS.autoSignIn: falseis refused unlessrequireEmailVerificationis true. The sign-up answer stays Better Auth’s: a session unlessrequireEmailVerificationis true, andUSER_ALREADY_EXISTSfor a taken address.- Core refuses a secret under 32 characters, and a current secret under an estimated 100 bits of entropy, at start. Better Auth only warns.
disableSignUpmaps to core’ssignUp: falseonly when every method and social provider that creates a user sets it. A mix is refused at start. A provider’sdisableImplicitSignUpis refused.- Users, social accounts, passwords, organizations, members, and passkeys carry over. A password rehashes to PBKDF2 at its first right sign-in.
- On an https
baseURL, the callback URL at each provider stays Better Auth’s<baseURL><basePath>/callback/<provider>. On http, it is<baseURL><basePath>/social/<provider>/callback. socialProviders.slackis refused at start. Core’s Slack subject is<team_id>:<user_id>, and a Better Auth Slack row holds the user id alone, so the person would get a second account. Rewrite each SlackaccountIdfirst, then use core’ssocial.slack.- Core trusts fewer provider addresses. A Microsoft address is verified only with the
xms_edov: trueclaim, and a GitLab address never. At a first such sign-in of a person with a password, core answersemail_taken_unverifiedwhere Better Auth links by address. - The ID-token audiences map. A Google
clientIdlist gives core its first id asclientIdand the rest associal.google.audiences. The Appleaudience, elseappBundleIdentifier, maps tosocial.apple.audiences. - Each user that the shim answers, such as at
/get-session, holds the fields of theanonymous,username, andphoneNumberplugins, as in Better Auth.phoneNumberis the proved number or null. An answer of a core route, such as the email sign-in, holds the five user keys only. Read the session for the fields. - A user with no address holds Better Auth’s placeholder address in
user.email. The storage reads it as no address: core never mails it and never counts it as proved. AgetTempEmailof the phone number plugin must answer an address onplaceholder.invalid. - With
emailDomainName, the storage readstemp-<id>@<emailDomainName>as no address only on the row with that id. Better Auth writes a random id there, so its older anonymous rows read as real addresses. Rewrite them to<id>@anonymous.placeholder.invalidbefore the move. - On Workers, pass
{ waitUntil: (p) => ctx.waitUntil(p) }toauth.handler. A code mail or an SMS then goes out after the answer. Without it, the handler waits for the mail, and the answer time tells an unverified user with a password. - On Next, pass
{ waitUntil: (p) => after(p) }as the second argument oftoNextJsHandler. On a serverless Node host, pass the host’swaitUntiltotoNodeHandlerthe same way. - The plugins
jwt,mcp,cimd,oidc-provider, andoauth-providerare refused. A JWT that Better Auth issued stops verifying at the cutover. - The user ids of Better Auth carry over. A user id must never be a
cl_value or an https URL, because a client id has that form.@authtempo/verifyreads an access token whosesubequals itsclient_idas a client with no person. Keep a custom Better Auth id generator to this rule before the app turns on core’s provider. - A Better Auth path that the app calls with its own
fetchanswers 404. Call the client method instead. The account paths and the email code paths are served in Better Auth’s shapes. - A revoke, the change of address, the link, the unlink, and the delete need a fresh session.
session.freshAgesets the window, and0is refused. A stale session answersSESSION_NOT_FRESHwith 403. /two-factor/disable,/two-factor/get-totp-uri, and/two-factor/generate-backup-codesneed a fresh session too, checked before the password.- Better Auth’s
list-sessionsneeds a fresh session. On authtempo the list needs a session only, as core’sGET /sessionsdoes. - A social link needs the provider’s verified address, equal to the account’s. Better Auth also links an unverified address of a trusted provider, and a different address with
allowDifferentEmails. On authtempo the callback answersemail_mismatchfor a different address, and both options are refused at start. - The shim refuses
additionalDataof the social start and of the link withNOT_SUPPORTED, because it serves nogetOAuthState(). After the move to core’screateAuth, use the state payload and readstateDatain core’s hooks. user.deleteUser.enabledstays off by default, as in Better Auth. An organization where the user is the last owner and other members remain stops the delete withSOLE_OWNER.
If it fails
Section titled “If it fails”BetterAuthCompatErrorat start: change each option in its list.relation "ta_limit" already exists: the schema holds the tables of the Postgres adapter. Run the compatibility storage on a schema without them.no such column: issueron D1: the 1.7 file ran on tables from before Better Auth 1.7. The failed run left its compat copies inmigrations_dir. Delete each copy whose name ends in_compat_better_auth.sql, or in_compat_schema_v5.sqlto_compat_schema_v10.sql. Then run the command again with--before-1.7.duplicate column name: memberCounton D1: thed1-before-1.70010 ran on the team tables of Better Auth 1.7. Use thed1file.invalid_token: a magic link, an invitation, or a delete link from before the cutover. Send it again.token_retired: an old Better Auth key that did not move, because Better Auth held it disabled, expired, or with no digest. Create a new key.