nextjs x supabase google auth authentication problems
Unanswered
Pacific sandlance posted this in #help-forum
Pacific sandlanceOP
Hey guys I am trying to utilize supabase's google auth, Everything works fine, I can clearly see the cookie from DevTools and I can console log it
But I am having trouble getting the session and apply it to supabase
The session returns null but cookies console log just fine... Anyone got some possible solutions?
console.log(cookies());But I am having trouble getting the session and apply it to supabase
The session returns null but cookies console log just fine... Anyone got some possible solutions?
export default async function Home() {
const supabase = createServerComponentClient({cookies});
console.log(cookies());
const { data: {session} } = await supabase.auth.getSession();
console.log(session);
if (session) {
redirect('/');
}
return (
<main>
<h1>Unauthorized</h1>
<Auth />
</main>
)
}4 Replies
Pacific sandlanceOP
It worked for a moment but when I logged out and logged in back on it stopped working .-.
Pacific sandlanceOP
Okay from what I can see... right now if I utilize
if (session) {
redirect('/');
} it stops workingbut if I remove it it works just fine
Pacific sandlanceOP
Will open an issue on github and see what's the issue