Skip to content

[finding] @better-auth/sso now accepts a schema.ssoProvider option — the adapter-level ssoProvider model bridge predates that and may be replaceable #8224

Description

@os-zhuang

Restart-when: closed #3002 (fold into that stable-line migration batch), or npm view @better-auth/sso version moves off the pinned 1.7.0-rc.2

Found while implementing #8193 (PR #8221), verifying the stale version attestation in auth-manager.ts. Observation-class: nothing is broken today, the current bridge works. Filed unassigned, no pm:queue, for the record. Measured, not inferred.

The stale claim

packages/plugins/plugin-auth/src/auth-manager.ts carried this next to the sso() plugin registration:

unlike `oauthProvider`, @better-auth/sso hardcodes its `ssoProvider`
model and accepts NO `schema` option (verified against 1.6.20 — no
mergeSchema, runtime never reads options.schema). Its table mapping to
`sys_sso_provider` must therefore be resolved by the better-auth adapter
/ a global model map, not per-plugin here (see AUTH_SSO_PROVIDER_SCHEMA).

That was true of 1.6.20. It is not true of the pinned @better-auth/sso@1.7.0-rc.2:

  • SSOOptions declares a schema member (dist/index-D1yk91me.d.mts): schema.ssoProvider.{ modelName, fields, additionalFields }, where fields covers issuer, oidcConfig, samlConfig, userId, providerId, organizationId, domain, domainVerified.
  • The runtime honours it (dist/index.mjs, the plugin's own schema: block): modelName: options?.modelName ?? options?.schema?.ssoProvider?.modelName ?? "ssoProvider", and every field resolves fieldName: options?.fields?.X ?? options?.schema?.ssoProvider?.fields?.X ?? "X".

PR #8221 corrects the comment to record what was actually re-measured, and deliberately leaves the bridge itself alone.

Why this might matter

The ssoProvider to sys_sso_provider mapping is currently done at the adapter / global-model-map layer (AUTH_MODEL_TO_PROTOCOL, AUTH_SSO_PROVIDER_SCHEMA) precisely because the plugin was believed to offer no other way. With schema.ssoProvider.modelName plus a per-field fieldName map now available upstream, that mapping could plausibly be expressed as a plugin option instead — closer to how oauthProvider is handled, and one fewer schema-less special case for the adapter to carry.

Why it is NOT being changed here

So this is recorded rather than acted on. Whether it is worth doing at all is a triage call — the current bridge may be preferable for reasons beyond this plugin.

Generalizable lesson

The comment was a version-stamped attestation that outlived its version, and the bump that invalidated it also shipped the total OIDC-registration breakage in #8193. Both were the same root cause: a dependency's surface moved and no gate noticed. Anywhere a comment says "verified against X", the pinned version drifting past X should be treated as an unverified claim, not a stale note.

Backlink: found during #8193.


Generated by Claude Code

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions