You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(plugin-auth): stop emitting the retired oidcConfig.mapping.id on OIDC SSO registration (#8193) (#8221)
@better-auth/sso declares oidcConfig.mapping as a strict object. `id` was a
real member in 1.6.20 and was honoured at login; the pinned 1.7.0-rc.2 retires
it and reads the federated subject from the OIDC `sub` claim directly, so the
key the bridge always sent made every OIDC registration answer 400.
Emit { email, name } (the strict schema's required members), refuse a non-`sub`
user-ID claim loudly rather than discarding it silently, and pin the path with
tests that drive the real /sso/register endpoint of a real better-auth
instance. Also corrects the stale "verified against 1.6.20" attestation in
auth-manager.ts to what was actually re-measured against 1.7.0-rc.2.
Claude-Session: https://claude.ai/code/session_01PEVB6w7D7uCszR9Mw1BL73
Co-authored-by: Claude <noreply@anthropic.com>
// `id` is not a key that moved — it was RETIRED upstream, so there is nowhere
132
+
// to re-home it. 1.6.20 declared the mapping as a plain (non-strict)
133
+
// `z.object` that DID carry `id`, and honoured it at login
134
+
// (`id: rawUserInfo[mapping.id || "sub"]`). 1.7.0-rc.2 deletes the member and
135
+
// hard-wires the federated subject to the OIDC `sub` claim
136
+
// (`id: readStringClaim(rawUserInfo, "sub")` / `id: idToken.sub`), then
137
+
// cross-checks it (`id_token_subject_missing`,
138
+
// `id_token_userinfo_subject_mismatch`). `extraFields` is NOT a substitute:
139
+
// it parses, but it is spread BEFORE `id` in the profile literal, so an
140
+
// `extraFields.id` is silently overwritten by `sub` — a no-op that reads as
141
+
// configured. The subject claim is simply not configurable any more, so a
142
+
// caller that asks for a different one is told so instead of being ignored.
143
+
constmapId=str(body?.mapId);
144
+
if(mapId&&mapId!=='sub'){
145
+
return{
146
+
status: 400,
147
+
body: {
148
+
success: false,
149
+
error: {
150
+
code: 'INVALID_REQUEST',
151
+
message:
152
+
'The user ID claim is not configurable: the federated subject is always read from the OIDC "sub" claim. Leave the user-ID claim mapping empty (or set it to "sub").',
0 commit comments