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
{{ message }}
Repository navigation
after-user-created hook fires on every external OAuth sign-in, not just on account creation #2726
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.
I already have a PR with a fix open and ready to be merged: #2656. It also has regression tests. Is that something that you could review @cstockton@xlgmokha ?
changed the title [-]`after-user-created` hook fires on every external OAuth sign-in, not just on account creation (fix included)[/-][+]`after-user-created` hook fires on every external OAuth sign-in, not just on account creation[/+]on Aug 24, 2026
Activity
swithek commentedon Aug 24, 2026
I already have a PR with a fix open and ready to be merged: #2656. It also has regression tests. Is that something that you could review @cstockton @xlgmokha ?
[-]`after-user-created` hook fires on every external OAuth sign-in, not just on account creation (fix included)[/-][+]`after-user-created` hook fires on every external OAuth sign-in, not just on account creation[/+]lovromazgon commentedon Oct 16, 2026
Done in #2656