You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The after-user-created Auth hook is documented to run once, after a new user is created. For external OAuth providers (GitHub, Google, etc.) it instead runs on every sign-in.
In the OAuth callback (internal/api/external.go), createdUser = true is set unconditionally, discarding the AccountLinkingDecision. That branch handles every OAuth sign-in, so the hook also fires for AccountExists (a returning user) and LinkAccount (a new identity linked to an existing user).
Only the external OAuth path is affected; the equivalent call sites in token_oidc.go, web3.go and samlacs.go all gate the hook on decision == models.CreateAccount.
To Reproduce
Configure an after-user-created HTTP hook.
Enable any external OAuth provider, e.g. GitHub.
Sign in with a new GitHub account → hook fires once.
Sign out, sign in with the same account again → hook fires again for the same user.
Expected behavior
The hook fires exactly once per user, when the account is created, matching the docs ("added after a user is created") and the behavior of the OIDC, Web3 and SAML sign-in paths.
Bug report
Describe the bug
The
after-user-createdAuth hook is documented to run once, after a new user is created. For external OAuth providers (GitHub, Google, etc.) it instead runs on every sign-in.In the OAuth callback (
internal/api/external.go),createdUser = trueis set unconditionally, discarding theAccountLinkingDecision. That branch handles every OAuth sign-in, so the hook also fires forAccountExists(a returning user) andLinkAccount(a new identity linked to an existing user).Only the external OAuth path is affected; the equivalent call sites in
token_oidc.go,web3.goandsamlacs.goall gate the hook ondecision == models.CreateAccount.To Reproduce
after-user-createdHTTP hook.Expected behavior
The hook fires exactly once per user, when the account is created, matching the docs ("added after a user is created") and the behavior of the OIDC, Web3 and SAML sign-in paths.
Screenshots
N/A
System information
supabase/auth, self-hosted and hostedmaster