Skip to main content
import { useStytchSession } from '@stytch/react';

export const SessionInfo = () => {
  const { session } = useStytchSession();

  return session ? <p>Session ID: {session.session_id}</p> : <p>No active session</p>;
};
{
  "session": { ... },
  "isInitialized": true,
  "fromCache": false
}

Documentation Index

Fetch the complete documentation index at: https://stytch.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

To get the active Session for the currently signed in User, use the useStytchSession hook. If no User is signed in, the returned value will be null. In non-React environments, use the session.getSync method to get the Session.

Return Value

session
object | null
The current Session.
fromCache
boolean
Whether the Session data is from persistent storage.