[PR #7870] [MERGED] fix(sso): only call provisionUser for new users #15849

Closed
opened 2026-04-13 10:15:50 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7870
Author: @bytaesu
Created: 2/9/2026
Status: Merged
Merged: 2/10/2026
Merged by: @himself65

Base: canaryHead: 2026-02-09/fix/provision-user-called-on-every-signin


📝 Commits (1)

  • 3e1952c fix(sso): only call provisionUser for new users, not on every sign-in

📊 Changes

2 files changed (+140 additions, -4 deletions)

View changed files

📝 packages/sso/src/oidc.test.ts (+137 -1)
📝 packages/sso/src/routes/sso.ts (+3 -3)

📄 Description


Summary by cubic

Call provisionUser only when a user is first created via SSO, not on every sign-in. This avoids duplicate provisioning and side effects on repeat logins.

  • Bug Fixes
    • Gate provisionUser behind isRegister in callbackSSO, callbackSSOSAML, and acsEndpoint.
    • Add test to verify it runs on first sign-in and not on subsequent sign-ins.

Written for commit 3e1952c50e. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7870 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 2/9/2026 **Status:** ✅ Merged **Merged:** 2/10/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `2026-02-09/fix/provision-user-called-on-every-signin` --- ### 📝 Commits (1) - [`3e1952c`](https://github.com/better-auth/better-auth/commit/3e1952c50e99c2af08050551a3b773e206093977) fix(sso): only call provisionUser for new users, not on every sign-in ### 📊 Changes **2 files changed** (+140 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/sso/src/oidc.test.ts` (+137 -1) 📝 `packages/sso/src/routes/sso.ts` (+3 -3) </details> ### 📄 Description - Closes #7857 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Call provisionUser only when a user is first created via SSO, not on every sign-in. This avoids duplicate provisioning and side effects on repeat logins. - **Bug Fixes** - Gate provisionUser behind isRegister in callbackSSO, callbackSSOSAML, and acsEndpoint. - Add test to verify it runs on first sign-in and not on subsequent sign-ins. <sup>Written for commit 3e1952c50e99c2af08050551a3b773e206093977. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 10:15:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#15849