SupabaseS
Supabase11mo ago
Nareg.T

Supabase Magic Link Authentication Issue:

I'm building a Svelte/SvelteKit app with 2 subdomains (pro.domain.com and domain.com) using Supabase auth with magic links.
Generating magic link:

const { data } = await supabaseAdmin.auth.admin.generateLink({
 type: 'magiclink',
 email,
 options: {
   redirectTo: 'http://localhost:5174/api/auth/callback'
 }
});


This generates a link like:
http://127.0.0.1:54321/auth/v1/verify?token=<token>&type=magiclink&redirect_to=http://localhost:5174/api/auth/callback

When clicking the link, Supabase redirects to my callback URL but with no auth data:

// My callback endpoint logs:
Full URL: http://localhost:5174/api/auth/callback
Search params: {}

Question: How do I properly handle the Supabase magic link callback to verify the user? What data should I expect from Supabase and how do I access it?
Was this page helpful?