Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
Getting Started
Session Management
Get Session

Get Session

Once a user is logged in, you often want to get the session object in order to use the data in some way. A common use-case is to show their profile picture or display some other user information.

import { auth } from "../auth"
export default async function UserAvatar() {
  const session = await auth()
  if (!session.user) return null
  return (
      <img src={session.user.img} alt="User Avatar" />

If you’d like to extend your session with more fields from your OAuth provider, for example, please check out our “extending the session” guide.

Auth.js © Balázs Orbán and Team - 2024