supabase / supabase-js

An isomorphic Javascript client for Supabase. Query your Supabase database, subscribe to realtime events, upload and download files, browse typescript examples, invoke postgres functions via rpc, invoke supabase edge functions, query pgvector.
https://supabase.com
MIT License
2.86k stars 220 forks source link

signInWithOtp make wrong redirect URL #962

Closed ak2i closed 3 months ago

ak2i commented 3 months ago

Bug report

Describe the bug

When sign-in with otp by e-mail magic link, it finally goes to wrong URL.

const { error } = await client.auth.signInWithOtp({
      email,
      options: {
        emailRedirectTo: `${location.origin}/mypage`,
      },
    })

this sends email which include magic link. but after authentication, it goes to /mypage#

To Reproduce

make login page as like above sample. use it to authenticate.

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

image

System information

J0 commented 3 months ago

Hey @ak2i,

Thanks for reporting the issue. Quick clarification: is the concern here the presence of a #? (e.g. in an ideal world the app would redirect to /mypage and not /mypage#)

Let us know!

kangmingtay commented 3 months ago

hey @ak2i, are you still facing this issue? You might wanna check out our guide on how to set up your redirect URLs correctly here: https://supabase.com/docs/guides/auth/concepts/redirect-urls