RegisterLogin
DocsPricing
RegisterLogin
  • Getting Started
  • Introduction
  • Quick Start
  • SDKs
  • React
  • TypeScript
  • Next.js
  • Express
  • NestJS
  • Python
  • API Reference
  • Support and Resources
  • FAQ
  • Contact

useSession()

Lightweight hook for accessing the current user session. Simplified alternative to useAuth() when you only need session data.


Overview

The useSession() hook provides access to the current session with properties: session (current user session or null), isLoading (whether session is being loaded), and error (error if session loading failed). Use this when you only need to read session data without sign in/out functionality.


Basic Usage

'use client';
import { useSession } from 'authsafe-nextjs';

export default function UserProfile() {
  const { session, isLoading } = useSession();

  if (isLoading) return <p>Loading...</p>;
  if (!session) return <p>Not signed in</p>;

  return (
    <div>
      <p>{session.name}</p>
      <p>{session.email}</p>
    </div>
  );
}

Best Practices
  • Use useSession() when you only need to read session data
  • Use useAuth() when you need sign in/out methods
  • For server components, use getAuth() instead

AuthSafe

Product

HighlightFeatureIntegrationPricingFAQ

Company

AboutBlogContact

Developer

DashboardDocumentation

Legal

Terms & ConditionsPrivacyComplianceShippingCancellationAI

© 2026 AuthSafe. All rights reserved.

We value your privacy

This website uses cookies for anonymous analytics to help us improve your experience. No personal information is stored or shared. You can allow or reject analytics tracking at any time. See our Privacy Policy.

We use cookies for anonymous analytics. No personal info is stored. See our Privacy Policy.