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

API Handlers

Pre-built handlers for OAuth authentication endpoints in Next.js API routes.


Overview

AuthSafe provides ready-to-use handlers for all authentication flows: handleSignIn to initiate OAuth sign in, handleCallback to process OAuth callback, handleLogout to sign out and clear session, and handleRefresh to refresh tokens. All handlers are compatible with both App Router and Pages Router.


Basic Usage

// app/api/auth/...authsafe/route.ts
import {
  handleSignIn,
  handleCallback,
  handleLogout,
  handleRefresh,
} from 'authsafe-nextjs/server';

export const GET = handleSignIn;
export const POST = handleCallback;

Best Practices
  • Use HTTPS in production — Always use secure cookies
  • Validate returnTo parameter — Prevent open redirect vulnerabilities
  • Use POST for logout/refresh to prevent CSRF attacks

AuthSafe

Product

HighlightFeatureIntegrationPricingFAQ

Company

AboutBlogContact

Developer

DashboardDocumentation

Legal

Terms & ConditionsPrivacyComplianceShippingCancellationAI

© 2026 AuthSafe. All rights reserved.

Valoramos su privacidad

Este sitio web utiliza cookies para análisis anónimos que nos ayudan a mejorar su experiencia. No se almacena ni comparte información personal. Puede permitir o rechazar el seguimiento analítico en cualquier momento. Consulte nuestra Política de Privacidad.

Usamos cookies para análisis anónimos. No se almacena información personal. Consulte nuestra Política de Privacidad.