Description
Have been spending a lot of time trying to figure out how to use the otp here - magic link seems to work ok in the ui (except there are issues with the email prefetching the link, making it invalid before it is even used which is making it impossible to use...). Apart from that the otp seems promising, but the problem is the flow - if we start with the base form, there is no where to click 'sign up with otp' and if you click the 'magic ilnk' and edit the email to include the otp, there is no way to redirect to the correct page (ie the otp page). And when we are redirected to the otp page, the user in addition has to input their email and the code which I have received doesnt seem to work (with the view="verify_otp").
Supabase auth is already very confusing and poorly doccumented - so hopefully the otp docs can be updated to show how to actually do it and how it is meant to be used? I have been trying for quite some time now getting nowhere trying to figure it out...
The code for example:
"use client";
import { Auth } from "@supabase/auth-ui-react";
import { ThemeSupa } from "@supabase/auth-ui-shared";
import supabase from "@/lib/supabase";
import { Database } from "@/lib/database.types";
import { createClientComponentClient } from "@supabase/auth-helpers-nextjs";
export default function AuthPage() {
const supabase = createClientComponentClient();
return (
<Auth
supabaseClient={supabase}
onlyThirdPartyProviders={false}
socialLayout={"horizontal"}
magicLink={true}
otpType="email"
theme="default"
appearance={{ theme: ThemeSupa }}
redirectTo={
${location.origin}/auth/callback
}/>
</div>
</div>
);
}