fix(sso): allow verified invitation account linking

This commit is contained in:
Nicolas Meienberger
2026-06-21 11:50:44 +02:00
parent dec9ac5b28
commit 4dd96307ec

View File

@@ -170,7 +170,10 @@ async function beforeAcceptInvitation({ invitation }: AcceptInvitationHookData)
export const ssoIntegration = {
plugin: sso({
trustEmailVerified: false,
// Better Auth's SSO callback only reaches our account-linking hook when the
// provider email is trusted. The hook below still enforces org membership or
// an explicit invitation intent before any existing account can be linked.
trustEmailVerified: true,
providersLimit: async (user: User) => {
const isOrgAdmin = await authService.isOrgAdminAnywhere(user.id);
return isOrgAdmin ? 10 : 0;