Hey, I am following the tutorial for adding Auth, ...
# help
a
Hey, I am following the tutorial for adding Auth, but I am running into a CORs error when running the
await supabase.auth.signIn({ email })
function
n
Hello @ani! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
a
This is when I am running the app on localhost
o
Hi How are you using Supabase in your project? Is it a NextJS project, a Svelte project, React.... ? @ani
a
Hi! It is a react project.
I am trying supabase for the first time, haven't done anything in terms of the DB and just wanted to add Auth for now.
o
hmm, do you have this same issue when you add a password field?
a
let me try it
yeah still the same error
my code is basically the exact same as the tutorial
o
Be sure in the "Authentification" > "Settings" tab you have ``http://localhost:3000`` for the ``site url`` field
a
yup that's there as well
the error that comes back is simply
Request Failed
o
Alright so in that case, i suppose it comes from the instance itself. I already got this issue too, and i just created a new instance. Can you try with another instance and tell me if it fixes the issue?
a
so you mean to create a new project?
o
Unfortunately yes. I call this kind of supabase instances "a cursed instance" xD
because the instance has an issue, and not your code
a
sure, trying that now
haven't done anything with the DB at all yet so its no issue :0
*:)
hey so that managed to work! thanks for your help!
i have a follow up question
once someone signs in via magic link w just their email
they are issued a JWT right? for an hour?
how do i listen for whether their JWT is still active and how to renew it?
o
hmm, there is no event in my knowledge to listen the jwt token change. But, you can listen for an auth change i guess: https://supabase.com/docs/reference/javascript/auth-onauthstatechange
a
ah okay
so does the token refresh happen by itself?
and would you just stick that onAuthStateChange inside a useEffect for react? sorry kind of a dumb question
g
If you are using supbase-js it refreshes the token for you. You can monitor onAuthStateChange and you will see the refresh event.
t