> ## 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.

# Using Stytch's session layer

> Sessions provide a way to uniquely identify users on your application and maintain useful state information, such as detecting whether a user is logged in or not, determining access privileges, personalizing experiences, and building user insights.

<Columns cols={2}>
  <Card title="Start of a session" href="/consumer-auth/manage-sessions/lifecycle/start-session" icon="arrow-up-right">
    When a user session starts.
  </Card>
</Columns>

## What is a session?

A session is a unique identifier for a user's authenticated state within your application. It ties together the user's identity, authentication factors, and session metadata.

Once a user successfully authenticates, Stytch mints a Session object for the user—represented by two tokens:

### Session represented by tokens

<Columns cols={3}>
  <Card title="User Session object" icon="braces" href="/api-reference/consumer/api/sessions/session-object">
    Represents an authenticated session for a specific user.
  </Card>

  <Card title="session_token" icon="coins" href="/consumer-auth/manage-sessions/jwts-and-tokens#using-session-tokens">
    An opaque token that's verified via API call.
  </Card>

  <Card title="session_jwt" icon="coins" href="/consumer-auth/manage-sessions/jwts-and-tokens#using-session-jwts">
    A signed token that can be locally verified.
  </Card>
</Columns>

Session tokens should be stored client-side (usually a browser cookie) and authenticated on each request.

***

## Session management

Stytch's SDKs provide a session management layer that abstracts token rotation, session validation, and more:

<Columns cols={2}>
  <Card title="Check for an active session" href="/consumer-auth/manage-sessions/check-active-session">
    Control your application behavior based on whether a user has an active session.
  </Card>

  <Card title="Authenticate a session" href="/consumer-auth/manage-sessions/validate-session">
    Validate session tokens or JWTs before any action that requires authorization.
  </Card>

  <Card title="Hydrate a session" href="/consumer-auth/manage-sessions/hydrate-session">
    Hydrate the frontend session state from the backend.
  </Card>

  <Card title="Add custom claims" href="/consumer-auth/manage-sessions/custom-claims">
    Encode additional information into your session JWTs using custom claims.
  </Card>

  <Card title="Cookies and sessions" href="/consumer-auth/manage-sessions/cookies">
    Options for cookie configuration and HttpOnly cookies.
  </Card>
</Columns>

### Session lifecycle

<Columns cols={2}>
  <Card title="Extend sessions & session expiration" href="/consumer-auth/manage-sessions/lifecycle/extend-or-expire-session">
    Session duration and extending the lifetime of a session.
  </Card>

  <Card title="Revoke sessions" href="/consumer-auth/manage-sessions/lifecycle/revoke-session">
    Immediately invalidate the session token, effectively logging the user out.
  </Card>
</Columns>
