workos / authkit-nextjs

The WorkOS library for Next.js provides convenient helpers for authentication and session management using WorkOS & AuthKit with Next.js.
MIT License
43 stars 9 forks source link

Callback after signup? #30

Closed ChristoRibeiro closed 2 months ago

ChristoRibeiro commented 2 months ago

Hi,

Is there a callback when a user has successfully signed up?

I would like to make a database call just after a signup.

Thanks for your help.

PaulAsjes commented 2 months ago

The most reliable way to write to your database after a successful signup would be via webhooks. It's unsafe to rely on a callback as the user might close the tab or window before the redirect to your site is complete.

Safest way is to listen for the user.created webhook and perform your database writes accordingly.