How SpaceZero implements secure authentication with OAuth providers, email/password, and Resend for transactional emails.
SpaceZero provides a complete authentication system out of the box.
User → Frontend (React) → Supabase Auth → Resend (emails)
In supabase/config.toml:
[auth]
site_url = "https://your-app.space"
redirect_urls = ["https://your-app.space/**"]
Transactional emails use Resend (not Supabase's built-in emails):
// functions/api/auth/send-email.ts
import { Resend } from 'resend';
const resend = new Resend(env.RESEND_API_KEY);
await resend.emails.send({
from: 'Your App <[email protected]>',
to: email,
subject: 'Reset your password',
html: renderPasswordResetEmail(appName, resetUrl),
});
Customizable branded templates in send-email.ts:
renderPasswordResetEmail()renderEmailConfirmationEmail()OAuth providers are typed as a union in src/hooks/useAuth.ts:
signInWithOAuth: (provider: 'google' | 'github') => Promise<void>;
To add a provider, extend the union type and the signInWithOAuth implementation.