Next.js Discord

Discord Forum

How to get the user id from getServerSession()

Unanswered
Siamese Crocodile posted this in #help-forum
Open in Discord
Siamese CrocodileOP
when i use getServerSession it only returns name, email and image.

import { getServerSession } from 'next-auth';

const MyProfile = async () => {
    const session = await getServerSession();

    if (!session){
      return <p>Access Denied</p>
    } else {
      console.log(session)
 

1 Reply

Little fire ant
Have you tried session.user.id ?