File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,6 +199,30 @@ export async function signIn(
199199 }
200200}
201201
202+ // Sign in or sign up with magic link (Passwordless)
203+ export async function signInWithEmail (
204+ email : string ,
205+ ) : Promise < { success : boolean ; error ?: string } > {
206+ try {
207+ const supabase = createClient ( )
208+
209+ const { error : signInError } = await supabase . auth . signInWithOtp ( {
210+ email,
211+ options : {
212+ emailRedirectTo : `${ window . location . origin } /auth/callback` ,
213+ }
214+ } )
215+
216+ if ( signInError ) {
217+ return { success : false , error : signInError . message }
218+ }
219+
220+ return { success : true }
221+ } catch ( error : any ) {
222+ return { success : false , error : error . message || 'Magic link failed' }
223+ }
224+ }
225+
202226// Sign out user
203227export async function signOut ( ) : Promise < void > {
204228 try {
You can’t perform that action at this time.
0 commit comments