Generate Email OTP via Edge Function

The docs say you can generate an OTP and send it to an email account. I want to send the OTP using an edge function (so I can customize the email).

What
type
do I use for emailing the user the OTP code?

const { data, error } = await supabase.auth.admin.generateLink({
  type: '???',
  email: 'email@example.com',
})

Is this even possible? I don't want to use magic links because then I have to manage multiple redirect locations. I prefer to send a code to their email and authenticate from wherever they attempted to sign in.

Docs reference: https://supabase.com/docs/reference/javascript/auth-admin-generatelink
Supabase API reference for JavaScript: Generate an email link
Was this page helpful?