Skip to main content

Sessions

Two strategies: cookies (default) and JWT.

from nexfetch_auth.core.config import SessionConfig

session=SessionConfig(strategy="cookie")

Sessions are HTTP-only cookies. Standard for browser apps.

JWT strategy

session=SessionConfig(strategy="jwt", jwt_secret="separate-jwt-secret")

Sessions are returned as JWT tokens in the response body. Send via Authorization: Bearer <token> header. Ideal for SPAs and mobile apps.

Endpoints

EndpointDescription
GET /get-sessionCurrent session and user
GET /list-sessionsAll active sessions for user
POST /revoke-sessionRevoke a specific session
POST /revoke-other-sessionsRevoke all except current
POST /refresh-tokenIssue a new session token
POST /sign-outRevoke current session