Next.js Discord

Discord Forum

why is my session variable null ?

Unanswered
i_lost_to_loba_kreygasm posted this in #help-forum
Open in Discord
import Image from "next/image";
import styles from "./page.module.css";
import { getServerSession } from 'next-auth/next'
import providerOptions from "@/pages/api/auth/[...nextauth]";
export default async function Home() {
const session=await getServerSession(providerOptions);
  console.log(session.user)
  return (
    <><h1>Hello</h1></>
  );
}

3 Replies

Toyger
@Toyger https://next-auth.js.org/configuration/nextjs#in-app-router
i do have cookies , i logged in using my gmail provider
can anybody help ?