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

Closed
opened 2026-04-13 09:31:47 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5913

State: closed
Merged: Yes


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.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5913 **State:** closed **Merged:** Yes --- 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. -->
GiteaMirror added the pull-request label 2026-04-13 09:31:47 -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#14563