[PR #5913] [MERGED] fix(sso): use the internalAdapter for user queries to avoid skipping database hooks #6316

Closed
opened 2026-03-13 12:54:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5913
Author: @hartbit
Created: 11/11/2025
Status: Merged
Merged: 11/11/2025
Merged by: @Bekacru

Base: canaryHead: sso-internal-adapter


📝 Commits (1)

  • 2de4e0a feat(sso): use the internalAdapter for creating users and accounts

📊 Changes

1 file changed (+31 additions, -56 deletions)

View changed files

📝 packages/sso/src/routes/sso.ts (+31 -56)

📄 Description

I noticed my user database hook wasn't being called when using the SSO plugin. I saw it came from the fact that it uses the adapter directly instead of the internal adapter when creating users and account. This fixes that.


Summary by cubic

Switch SSO user/account creation to internalAdapter so user database hooks and side effects run during SAML logins. Aligns SSO behavior with standard auth with no API changes.

  • Bug Fixes
    • Use internalAdapter.createUser/createAccount in callbackSSOSAML and acsEndpoint.
    • Keep existing fields and trustEmailVerified logic; timestamps handled by internal adapter.

Written for commit 2de4e0a8f2. Summary will update automatically 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/5913 **Author:** [@hartbit](https://github.com/hartbit) **Created:** 11/11/2025 **Status:** ✅ Merged **Merged:** 11/11/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `sso-internal-adapter` --- ### 📝 Commits (1) - [`2de4e0a`](https://github.com/better-auth/better-auth/commit/2de4e0a8f2e552b2c99d38bca3da17f460ffaec2) feat(sso): use the internalAdapter for creating users and accounts ### 📊 Changes **1 file changed** (+31 additions, -56 deletions) <details> <summary>View changed files</summary> 📝 `packages/sso/src/routes/sso.ts` (+31 -56) </details> ### 📄 Description I noticed my user database hook wasn't being called when using the SSO plugin. I saw it came from the fact that it uses the adapter directly instead of the internal adapter when creating users and account. This fixes that. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Switch SSO user/account creation to internalAdapter so user database hooks and side effects run during SAML logins. Aligns SSO behavior with standard auth with no API changes. - **Bug Fixes** - Use internalAdapter.createUser/createAccount in callbackSSOSAML and acsEndpoint. - Keep existing fields and trustEmailVerified logic; timestamps handled by internal adapter. <sup>Written for commit 2de4e0a8f2e552b2c99d38bca3da17f460ffaec2. Summary will update automatically 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-03-13 12:54:35 -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#6316