Commit 4109153
fix(plugin-auth,platform-objects): close @better-auth/oauth-provider 1.7 schema drift — restore platform SSO (#3080)
* fix(plugin-auth,platform-objects): close @better-auth/oauth-provider 1.7 schema drift — restore platform SSO
The better-auth 1.7.0-rc.1 bump (4ab16f8 "pnpm upgrade") changed the
oauth-provider model schemas, but the sys_oauth_* platform objects and the
camelCase→snake_case fieldName mappings in auth-schema-config.ts were never
updated. Token exchange then 500s with `table sys_oauth_access_token has no
column named authorizationCodeId`, breaking platform SSO ("Continue with
ObjectStack") end-to-end for every environment login — on SQLite AND
Postgres control planes alike.
- sys_oauth_access_token / sys_oauth_refresh_token: add
authorization_code_id (indexed), resources, requested_user_info_claims,
confirmation; access adds revoked; refresh adds rotated_at,
rotation_replay_response, rotation_replay_expires_at.
- sys_oauth_consent: add resources, requested_user_info_claims.
- sys_oauth_application: add jwks, jwks_uri, backchannel_logout_uri,
backchannel_logout_session_required, dpop_bound_access_tokens (1.7 DCR
writes dpopBoundAccessTokens with a default — same crash class).
- New objects for the three models 1.7 introduced: sys_oauth_resource,
sys_oauth_client_resource (RFC 8707 resource indicators, used by the MCP
OAuth track), sys_oauth_client_assertion (RFC 7523 jti replay
prevention); registered in the auth manifest, SystemObjectName, i18n
extract config, and buildOauthProviderPluginSchema().
- Mappings extended for every camelCase field; regenerated the
platform-objects translation bundles (additive only).
- NEW oauth-provider-schema-parity.test.ts: iterates the INSTALLED
plugin's declared schema and fails when any writable column is missing
from the platform objects — the next better-auth bump that adds fields
breaks at test time, not in production. (This test is what surfaced the
three brand-new 1.7 models above.)
Companion changes: cloud registers the ≥1.7 social-flow callback format
(/api/v1/auth/callback/<provider>) alongside the legacy one, and
@object-ui/auth signs OIDC providers in via POST /sign-in/social.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(dogfood): OIDC authorization-code flow e2e — real kernel, real token exchange
Drives authorize → code → token → userinfo against a bootStack kernel with
OS_OIDC_PROVIDER_ENABLED, seeding the client row exactly the way cloud's
seedPlatformSsoClient does (hashed secret, skip_consent, client_secret_basic,
≥1.7 /api/v1/auth/callback/<provider> redirect_uri). The token-exchange step
is the hop that 500'd in production on the 1.7 schema drift; verified the
test fails (2/3) when the authorization_code_id column is removed and passes
(3/3) with the fix. Complements the static parity gate in plugin-auth.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 5ffff3b commit 4109153
20 files changed
Lines changed: 1570 additions & 26 deletions
File tree
- .changeset
- packages
- platform-objects
- scripts
- src
- apps/translations
- identity
- plugins/plugin-auth/src
- qa/dogfood/test
- spec/src/system/constants
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
Lines changed: 177 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1187 | 1187 | | |
1188 | 1188 | | |
1189 | 1189 | | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
1190 | 1202 | | |
1191 | 1203 | | |
1192 | 1204 | | |
| |||
1198 | 1210 | | |
1199 | 1211 | | |
1200 | 1212 | | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
1201 | 1221 | | |
1202 | 1222 | | |
1203 | 1223 | | |
| |||
1312 | 1332 | | |
1313 | 1333 | | |
1314 | 1334 | | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
1315 | 1347 | | |
1316 | 1348 | | |
1317 | 1349 | | |
| |||
1321 | 1353 | | |
1322 | 1354 | | |
1323 | 1355 | | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
1324 | 1364 | | |
1325 | 1365 | | |
1326 | 1366 | | |
| |||
1352 | 1392 | | |
1353 | 1393 | | |
1354 | 1394 | | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
1355 | 1407 | | |
1356 | 1408 | | |
1357 | 1409 | | |
| |||
1366 | 1418 | | |
1367 | 1419 | | |
1368 | 1420 | | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
1369 | 1433 | | |
1370 | 1434 | | |
1371 | 1435 | | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
1372 | 1440 | | |
1373 | 1441 | | |
1374 | 1442 | | |
| |||
1392 | 1460 | | |
1393 | 1461 | | |
1394 | 1462 | | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
1395 | 1471 | | |
1396 | 1472 | | |
1397 | 1473 | | |
| |||
1404 | 1480 | | |
1405 | 1481 | | |
1406 | 1482 | | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
1407 | 1584 | | |
1408 | 1585 | | |
1409 | 1586 | | |
| |||
0 commit comments