Clerk: Is it possible to create custom metadata on signup using Clerk?

I need to create a custom metadata "credits" on each new user object, is it possible to achieve that with Clerk? One of my ideas was to call the api route after sign up which will update user object using clerkClient.
await signUp.authenticateWithRedirect({
strategy: provider,
redirectUrl: '/dashboard',
redirectUrlComplete: '/dashboard',
});

await fetch('...');
await signUp.authenticateWithRedirect({
strategy: provider,
redirectUrl: '/dashboard',
redirectUrlComplete: '/dashboard',
});

await fetch('...');
But fetch never get called because authenticateWithRedirect automatically redirects to the /dashboard as soon as sign up happens. Any ideas, how to achieve this? I need to create public metadata, so unsafeMetadata is not a solution.
3 Replies
Huperniketes
Huperniketes17mo ago
You can create a webhook API for Clerk to notify you when a user's been created.
Huperniketes
Huperniketes17mo ago
Webhooks | Clerk
Information about receiving event notifications with Clerk webhooks
variable_name
variable_nameOP17mo ago
Thanks, solved.
Want results from more Discord servers?
Add your server