Closed phongplus closed 1 year ago
I think you need to call a different method in v2: https://supabase.com/docs/reference/javascript/next/auth-signinwithpassword
Thanks for @soedirgo It work, so any version or package of supabase auth ui working with v2 ? i try using @supabase/ui and supabase-community/auth-ui-react also not supported.
I'm not familiar with these libraries, but I'm guessing they're still on v1. I suggest creating an issue on these libs to use supabase-js v2, though we need to move supabase-js out of prerelease first.
Hi, any update on this? I'm trying Auth with Next and Typescript and getting errors such as: supabase.auth.signIn is not a function and supabase.auth.session is not a function
Yes, you need to follow the migration notes here, though you may not be able to use auth-helpers, auth-ui, etc. atm since they're using supabase-js v1.
thanks, that helped.
In UserContext.tsx I have:
return () => {
authListener?.unsubscribe()
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
VS Code is throwing: Property 'unsubscribe' does not exist on type '{ subscription: Subscription; }'.
I couldn't see anything in migration notes on this, are you able to suggest how to resolve please?
Maybe authListener?.subscription.unsubscribe()
?
thanks, also helpful! Thinking I sholud've stuck with working in React and js - but sorry one last request - I've refactored session() to getSession(), but having trouble setting session in userContext as getSession returns a promise so VS code throws an error and the app doesn' recognise if the user is logged in:
const [session, setSession] = useState<Session | null>( supabaseClient.auth.getSession()
)
Hmm I'm not familiar with React myself - cc @alaister
@strangecarr it might be worth checking out this section of the next.js guide in the supabase docs, as it's got a good example of storing the session in state, which you should be able to apply to your user context.
Hope it helps!
thanks a lot, yes got it working now. Main issue was me getting v1 and v2 mixed up. Thanks for your help!
Similar to this is the supabase.auth.user()
also different now. I get a similar not function error.
Closing this as OP's issue is resolved. Please follow the migration notes linked above for other obsoleted methods.
change signIn
function with signInWithPassword
Supabase client
dependencies
is supabase support react 18 ?