Skip to content

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.

  • An app on Better Auth 1.7, on Postgres through postgres.js, on D1, or on a SQLite file through node:sqlite or better-sqlite3. Better Auth compatibility lists what it keeps.
  • The tables user, session, account, verification, organization, member, invitation, and passkey. 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.

Nothing leaves the database: the app keeps its own tables.

  1. Back up the database before the move, with pg_dump on Postgres.
  2. On D1, back it up with wrangler d1 export <database> --remote --output backup.sql.

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.

  1. List the compat migrations that the database lacks, and apply nothing.
  2. Add --before-1.7 on D1 or SQLite when the tables are from before Better Auth 1.7.
  3. 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 ….

Terminal window
authtempo migrate --target postgres --url-env DATABASE_URL --tables compat --dry-run
authtempo migrate --target d1 --database <database> --remote --tables compat --dry-run
authtempo migrate --target sqlite --file <path> --tables compat --dry-run
  1. Run the same command without --dry-run.
  2. 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.
  3. 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. driver comes from an entry of @authtempo/adapter-sqlite.
  4. 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"
}
}
  1. Keep both adapters in the list, also for an app on one database. The server entry loads both.
  1. Run authtempo check <base url> against the API.
  2. Sign in once with a known user by each method: the password, the magic link, and each social provider.
Terminal window
authtempo check https://api.example.com

The test below runs the sample against a database in memory. It also shows the error at start.

The test of this guide
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");
});
});
  1. Core stores no provider access token (spec 9). So getAccessToken has no answer, and each caller of it breaks at the cutover. Move each call to the provider’s own token flow before the move.
  2. The session cookie is __Host-tempo_session (plan 12b), and a browser never sends a __Host- cookie to a sibling subdomain. So advanced.crossSubDomainCookies has no map, and an app that shares its session across subdomains breaks at the cutover.
  3. Remove each import of better-auth/db, better-auth/types, and the access subpaths. The package does not export them.
  4. Start the server once. Read the list of the one BetterAuthCompatError, and change or remove each option that it names.
A Better Auth server on authtempo
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.

  1. Wrap the handler in place of hooks. Core has no request hooks.
  1. Do the steps of The cutover.
  2. Register the new callback URL at each social provider before the cutover.
  3. With the admin plugin, carry the admins. Core gives operator power by the platform role only, never by Better Auth’s role column.
    • Make one admin the first operator, once, with auth.tempo.api.operator.createAdmin in 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-role from 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 authtempo option takes no operator secret, so the CLI’s create-admin and users commands do not reach the app.

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.

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.

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:

  1. Add the column. When the column exists already, the command fails with duplicate column name: taProved. Then go to step 2.
  2. Fill one page of 10,000 sessions. Run the command again until changes in the meta of its answer is 0. Each page scans the rows that earlier pages marked, about 50 million row reads for a million sessions.
  3. Write version 16 in ta_meta.
  4. Write the compat version 13 in ta_meta. With it, authtempo migrate --tables compat copies no 0013.
Terminal window
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.

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.

  1. Before the cutover, copy the database. Apply the compat migrations to the copy: storage.migrate() on Postgres, or the D1 files with wrangler d1 migrations apply. Without them, the storage refuses the copy with schema_mismatch, and the dry run cannot start. Then run moveBetterAuthApiKeys with dryRun: true against the copy. On D1, run it in a Worker with the D1 binding, as the compat package README shows. A stored prefix outside movedPrefixes, or a row with no prefix, makes the dry run throw BetterAuthCompatError. 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.
  2. Put each stored prefix other than defaultPrefix in authtempo.movedKeyPrefixes. Re-issue each key with no prefix, and delete its row. Without it, the move throws before its first write and moves nothing. Pass movedPrefixes: movedKeyPrefixesOf(options) to the move, so it reads the list that core reads.
  3. Tell each owner whose key the report skips. skippedKeys names each row id, its owner, and the reason. The reasons are disabled, expired, noDigest, noCreator, noOwner, invalidName, invalidMetadata, and wideWindow. noDigest is a key with no digest. noCreator is an organization key with no creator and no owner. noOwner is a key whose user or organization is gone. invalidName is a name over 80 characters or with a control character. invalidMetadata is metadata over 4096 bytes. wideWindow is 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 name Moved key. present is a row that an earlier run moved. After the cutover each other skipped key answers 401 token_retired, and every script that uses one stops. verifyApiKey answers KEY_DISABLED for it.
  4. 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 401 token_retired. This gap is an outage of each script with an old key, so keep it short. Run step 5 right after the deploy.
  5. Run moveBetterAuthApiKeys with dryRun: false. On D1, run it in a Worker with the D1 binding, as the compat package README shows. It records each moved row in ta_moved_token, so a second run skips it, and a revoked key stays revoked. Without it, every old key answers token_retired by its prefix, and the key list shows no row for it.
  6. A resource server with @authtempo/verify passes movedPrefixes, the same list. It passes movedKind, with that kind in accept: "api-token" for references: "user", "organization-token" for "organization". Without them, the verifier answers null for every moved key. A new to_ key needs "organization-token" in accept.
  7. Change the app code that reads the apikey table itself, and each check of the old prefix. Without it, a new to_ key never authenticates, and the key list shows only the old table.
  8. When every owner moved, drop the apikey table 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.

  • Better Auth’s defaults apply: a session lives 7 days and refreshes after 1 day.
  • The session cookie is __Host-tempo_session, not better-auth.session_token. Change each test and each legal page that names the old cookie. The shim read tempo_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.appURL is the origin where each sign-in lands, by default the origin of baseURL. An absolute callbackURL off that origin answers 403 with INVALID_CALLBACK_URL. authtempo.passwordHash replaces betterAuthPasswordHash().
  • session.token holds 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 taProved true 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: true maps to password.requireVerified. An unverified sign-in answers EMAIL_NOT_VERIFIED and gets a new verify link, also when sendOnSignIn is absent.
  • secrets: [{ version, value }] maps to core’s secrets. Version 0 is refused: renumber from 1. With secret, version 1 must be the value of secret. The shim does not read BETTER_AUTH_SECRETS.
  • autoSignIn: false is refused unless requireEmailVerification is true. The sign-up answer stays Better Auth’s: a session unless requireEmailVerification is true, and USER_ALREADY_EXISTS for 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.
  • disableSignUp maps to core’s signUp: false only when every method and social provider that creates a user sets it. A mix is refused at start. A provider’s disableImplicitSignUp is 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.slack is 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 Slack accountId first, then use core’s social.slack.
  • Core trusts fewer provider addresses. A Microsoft address is verified only with the xms_edov: true claim, and a GitLab address never. At a first such sign-in of a person with a password, core answers email_taken_unverified where Better Auth links by address.
  • The ID-token audiences map. A Google clientId list gives core its first id as clientId and the rest as social.google.audiences. The Apple audience, else appBundleIdentifier, maps to social.apple.audiences.
  • Each user that the shim answers, such as at /get-session, holds the fields of the anonymous, username, and phoneNumber plugins, as in Better Auth. phoneNumber is 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. A getTempEmail of the phone number plugin must answer an address on placeholder.invalid.
  • With emailDomainName, the storage reads temp-<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.invalid before the move.
  • On Workers, pass { waitUntil: (p) => ctx.waitUntil(p) } to auth.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 of toNextJsHandler. On a serverless Node host, pass the host’s waitUntil to toNodeHandler the same way.
  • The plugins jwt, mcp, cimd, oidc-provider, and oauth-provider are 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/verify reads an access token whose sub equals its client_id as 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 fetch answers 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.freshAge sets the window, and 0 is refused. A stale session answers SESSION_NOT_FRESH with 403.
  • /two-factor/disable, /two-factor/get-totp-uri, and /two-factor/generate-backup-codes need a fresh session too, checked before the password.
  • Better Auth’s list-sessions needs a fresh session. On authtempo the list needs a session only, as core’s GET /sessions does.
  • 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 answers email_mismatch for a different address, and both options are refused at start.
  • The shim refuses additionalData of the social start and of the link with NOT_SUPPORTED, because it serves no getOAuthState(). After the move to core’s createAuth, use the state payload and read stateData in core’s hooks.
  • user.deleteUser.enabled stays off by default, as in Better Auth. An organization where the user is the last owner and other members remain stops the delete with SOLE_OWNER.
  • BetterAuthCompatError at 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: issuer on D1: the 1.7 file ran on tables from before Better Auth 1.7. The failed run left its compat copies in migrations_dir. Delete each copy whose name ends in _compat_better_auth.sql, or in _compat_schema_v5.sql to _compat_schema_v10.sql. Then run the command again with --before-1.7.
  • duplicate column name: memberCount on D1: the d1-before-1.7 0010 ran on the team tables of Better Auth 1.7. Use the d1 file.
  • 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.