Complete the code to send a magic link to the user's email.
const { data, error } = await supabase.auth.signInWithOtp({ email: [1] });You need to provide the user's email to send the magic link.
Complete the code to check if there was an error sending the magic link.
if ([1]) { console.error('Error sending magic link:', error.message); }
The error object indicates if sending the magic link failed.
Fix the error in the code to correctly handle the magic link sign-in.
const { data, error } = await supabase.auth.[1]({ email });Use signInWithOtp to send a magic link for passwordless login.
Fill both blanks to configure the magic link sign-in to redirect after login.
const { data, error } = await supabase.auth.signInWithOtp({
email,
options: {
[1]: [2]
}
});The emailRedirectTo option sets the URL to redirect after magic link sign-in. The value is the callback URL.
Fill all three blanks to handle the magic link sign-in response and check for errors.
const { [1], [2] } = await supabase.auth.signInWithOtp({ email });
if ([3]) {
console.error('Failed to send magic link:', error.message);
}data instead of error for errors.The response destructures data and error. The error variable is checked to detect failure.
