Skip to Content
Auth recipesSupabase Auth

Supabase Auth

Check the invite on your server before calling signUp, then report the activation. Keep WAITLISTLY_SECRET_KEY in server code only.

app/signup/actions.ts (Next.js)
'use server'; import { createClient } from '@/lib/supabase/server'; import { verifyInvite, reportActivation } from '@/lib/waitlistly'; export async function signUp(formData: FormData) { const email = String(formData.get('email')); const password = String(formData.get('password')); const code = String(formData.get('invite_code') || ''); const invite = await verifyInvite(code); if (!invite.valid || invite.email !== email.toLowerCase()) { return { error: 'This invite is not valid for this email.' }; } const supabase = await createClient(); const { error } = await supabase.auth.signUp({ email, password }); if (error) return { error: error.message }; await reportActivation(code); }

[!NOTE] Turn off public sign-ups in Supabase (Authentication → Providers → Email → Allow new users to sign up) if every account must come through an invite, and create users with the service role in this action instead.

verifyInvite and reportActivation are the helpers from the Next.js guide.

Last updated on