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

Route Handlers

Pre-built handlers for OAuth authentication flow in Express.js applications.


Overview

AuthSafe provides ready-to-use route handlers for all OAuth 2.1 flows: handleSignIn() to initiate sign in, handleCallback() to process the OAuth callback, handleLogout() to sign out, and handleRefresh() to refresh access tokens.


Basic Usage

import { handleSignIn, handleCallback, handleLogout } from 'authsafe-express';

app.get('/auth/signin', (req, res) => {
  handleSignIn(req, res, config);
});

app.get('/auth/callback', (req, res) => {
  handleCallback(req, res, config);
});

app.get('/auth/logout', (req, res) => {
  handleLogout(req, res, config);
});

Best Practices
  • handleSignIn() generates PKCE code challenge, nonce, and state parameter
  • handleCallback() requires clientSecret for token exchange
  • Use returnTo query parameter to specify redirect destination after sign in

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.