iamshaunjp / nextjs-masterclass

All course files for the Next.js Master Class course on Net Ninja Pro.
149 stars 85 forks source link

Lesson 25 - Email redirect callback #6

Open TomSOIreland opened 12 months ago

TomSOIreland commented 12 months ago

Hi,

I am having an issue with link in the email confirmation. As soon as I click it I am getting redirected to a login page with url containing http://localhost:3000/login#error=unauthorized_client&error_code=401&error_description=Email+link+is+invalid+or+has+expired.

After searching a bit I found these issues with supabase:

https://github.com/supabase/gotrue-js/issues/342

https://github.com/supabase/gotrue-js/issues/503

Could you hint how to deal with it in tutorial app?

TIA

Tom

dbribe commented 11 months ago

Hey there. Having the same issue and it started recently. Did you find out what was the problem?

loweceo commented 11 months ago

I have the same problem but only with the new version of Outlook, with Gmail, or when I copy-paste rather than click on the link, it works.

Ashley-small commented 10 months ago

Hi Tom,

Looking at the course files the problem is in the sign up flow. Initially it stumped me but you have to add the data parameter to this sign in function.

let { data, error } = await supabase.auth.signUp({ email, password, options: { emailRedirectTo: ${location.origin}/api/auth/callback, },

I found that without including the data, it will always return an invalid or expired email link which means that you won't be able to use the data object when you eventually require it.

acodevteam commented 8 months ago

Hi, Did anyone eventually get a solution for this? I keep getting a 500 code internal server error, then I get an invalid or expired email link error. But I followed the exact same code in the tutorial.