Skip to content

feat: add after-user-created hook#2169

Merged
cstockton merged 3 commits intomasterfrom
cs/feat-add-after-user-created-hook
Sep 23, 2025
Merged

feat: add after-user-created hook#2169
cstockton merged 3 commits intomasterfrom
cs/feat-add-after-user-created-hook

Conversation

@cstockton
Copy link
Contributor

This PR implements the after-user-created hook which runs whenever a new user has been successfully created.

Summary:

  • Add triggerAfterUserCreated method to the *API object in internal/api/hooks.go
  • Update user creation paths to call triggerAfterUserCreated after a new user is persisted:
    • internal/api/anonymous.go
    • internal/api/external.go
    • internal/api/invite.go
    • internal/api/mail.go
    • internal/api/signup.go
    • internal/api/samlacs.go
    • internal/api/token_oidc.go
    • internal/api/web3.go
  • Extend createAccountFromExternalIdentity to return an AccountLinkingDecision to detect newly created accounts
  • Add full end-to-end verification of the new hook in internal/api/e2e_test.go

@cstockton cstockton requested a review from a team as a code owner September 17, 2025 20:38
@coveralls
Copy link

coveralls commented Sep 17, 2025

Pull Request Test Coverage Report for Build 17960008964

Details

  • 49 of 102 (48.04%) changed or added relevant lines in 10 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.04%) to 67.658%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/api/anonymous.go 1 3 33.33%
internal/api/hooks.go 8 10 80.0%
internal/api/invite.go 1 3 33.33%
internal/api/mail.go 7 9 77.78%
internal/api/signup.go 1 3 33.33%
internal/api/web3.go 16 20 80.0%
internal/api/token_oidc.go 0 9 0.0%
internal/api/samlacs.go 0 10 0.0%
internal/api/external.go 10 30 33.33%
Files with Coverage Reduction New Missed Lines %
internal/api/mail.go 1 65.25%
Totals Coverage Status
Change from base Build 17947966352: -0.04%
Covered Lines: 13035
Relevant Lines: 19266

💛 - Coveralls

This PR implements the `after-user-created` hook which runs whenever a
new user has been successfully created.

Summary:
- Add `triggerAfterUserCreated` method to the `*API` object
  in `internal/api/hooks.go`
- Update user creation paths to call `triggerAfterUserCreated` after a
  new user is persisted:
  - internal/api/anonymous.go
  - internal/api/external.go
  - internal/api/invite.go
  - internal/api/mail.go
  - internal/api/signup.go
  - internal/api/samlacs.go
  - internal/api/token_oidc.go
  - internal/api/web3.go
- Extend `createAccountFromExternalIdentity` to return an
  `AccountLinkingDecision` to detect newly created accounts
- Add full end-to-end verification of the new hook in
  `internal/api/e2e_test.go`
@cstockton cstockton force-pushed the cs/feat-add-after-user-created-hook branch from 9ac0ed5 to e0da845 Compare September 17, 2025 21:16
@cstockton cstockton merged commit bd80df8 into master Sep 23, 2025
5 checks passed
@cstockton cstockton deleted the cs/feat-add-after-user-created-hook branch September 23, 2025 21:59
fadymak pushed a commit that referenced this pull request Sep 30, 2025
This PR implements the `after-user-created` hook which runs whenever a
new user has been successfully created.

Summary:
- Add `triggerAfterUserCreated` method to the `*API` object in
`internal/api/hooks.go`
- Update user creation paths to call `triggerAfterUserCreated` after a
new user is persisted:
  - internal/api/anonymous.go
  - internal/api/external.go
  - internal/api/invite.go
  - internal/api/mail.go
  - internal/api/signup.go
  - internal/api/samlacs.go
  - internal/api/token_oidc.go
  - internal/api/web3.go
- Extend `createAccountFromExternalIdentity` to return an
`AccountLinkingDecision` to detect newly created accounts
- Add full end-to-end verification of the new hook in
`internal/api/e2e_test.go`

Co-authored-by: Chris Stockton <[email protected]>
fadymak pushed a commit that referenced this pull request Nov 4, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.181.0](v2.180.0...v2.181.0)
(2025-10-31)


### Features

* add `.well-known/openid-configuration`
([#2197](#2197))
([9a8d0df](9a8d0df))
* add `auth_migration` annotation for the migrations
([#2234](#2234))
([b276d0b](b276d0b))
* add advisor to notify you when to double the max connection pool
([#2167](#2167))
([a72f5d9](a72f5d9))
* add after-user-created hook
([#2169](#2169))
([bd80df8](bd80df8))
* add support for account changes notifications in email send hook
([#2192](#2192))
([6b382ae](6b382ae))
* email address changed notification
([#2181](#2181))
([047f851](047f851))
* identity linked/unlinked notifications
([#2185](#2185))
([7d46936](7d46936))
* introduce v2 refresh token algorithm
([#2216](#2216))
([dea5b8e](dea5b8e))
* MFA factor enrollment notifications
([#2183](#2183))
([53db712](53db712))
* notify users when their phone number has changed
([#2184](#2184))
([21f3070](21f3070))
* **oauthserver:** add OAuth client admin update endpoint
([#2231](#2231))
([6296a5a](6296a5a))
* properly handle redirect url fragments and unusual hostnames
([#2200](#2200))
([aa0ac5b](aa0ac5b))
* store latest challenge/attestation data
([#2179](#2179))
([01ebce1](01ebce1))
* support percentage based db limits with reload support
([#2177](#2177))
([1731466](1731466))
* webauthn support schema changes, update openapi.yaml
([#2163](#2163))
([68cb8d2](68cb8d2))


### Bug Fixes

* gosec incorrectly warns about accessing signature[64]
([#2222](#2222))
([bca6626](bca6626))
* **openapi:** add missing OAuth client registration fields
([#2227](#2227))
([cf39a8a](cf39a8a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
DevRyuki pushed a commit to sasatech-gk/supabase-auth that referenced this pull request Feb 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.181.0](supabase/auth@v2.180.0...v2.181.0)
(2025-10-31)


### Features

* add `.well-known/openid-configuration`
([supabase#2197](supabase#2197))
([9a8d0df](supabase@9a8d0df))
* add `auth_migration` annotation for the migrations
([supabase#2234](supabase#2234))
([b276d0b](supabase@b276d0b))
* add advisor to notify you when to double the max connection pool
([supabase#2167](supabase#2167))
([a72f5d9](supabase@a72f5d9))
* add after-user-created hook
([supabase#2169](supabase#2169))
([bd80df8](supabase@bd80df8))
* add support for account changes notifications in email send hook
([supabase#2192](supabase#2192))
([6b382ae](supabase@6b382ae))
* email address changed notification
([supabase#2181](supabase#2181))
([047f851](supabase@047f851))
* identity linked/unlinked notifications
([supabase#2185](supabase#2185))
([7d46936](supabase@7d46936))
* introduce v2 refresh token algorithm
([supabase#2216](supabase#2216))
([dea5b8e](supabase@dea5b8e))
* MFA factor enrollment notifications
([supabase#2183](supabase#2183))
([53db712](supabase@53db712))
* notify users when their phone number has changed
([supabase#2184](supabase#2184))
([21f3070](supabase@21f3070))
* **oauthserver:** add OAuth client admin update endpoint
([supabase#2231](supabase#2231))
([6296a5a](supabase@6296a5a))
* properly handle redirect url fragments and unusual hostnames
([supabase#2200](supabase#2200))
([aa0ac5b](supabase@aa0ac5b))
* store latest challenge/attestation data
([supabase#2179](supabase#2179))
([01ebce1](supabase@01ebce1))
* support percentage based db limits with reload support
([supabase#2177](supabase#2177))
([1731466](supabase@1731466))
* webauthn support schema changes, update openapi.yaml
([supabase#2163](supabase#2163))
([68cb8d2](supabase@68cb8d2))


### Bug Fixes

* gosec incorrectly warns about accessing signature[64]
([supabase#2222](supabase#2222))
([bca6626](supabase@bca6626))
* **openapi:** add missing OAuth client registration fields
([supabase#2227](supabase#2227))
([cf39a8a](supabase@cf39a8a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants