Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Example showing how to use Auth.js with Express.

License

Notifications You must be signed in to change notification settings

nextauthjs/express-auth-example

Repository files navigation

The example repository is maintained from a monorepo. Pull Requests should be opened against nextauthjs/next-auth.


Express Auth - Example App

Open Source. Full Stack. Own Your Data.

Overview

This is the official Express Auth example for Auth.js.

Getting started

You can instantly deploy this example to Vercel by clicking the following button.

Environment Variables

Once deployed, kindly ensure you set all required environment variables in the Environment section of your hosting service.

Node.js Compatibility

The recommended version of Node.js to use in this example is Node.js v20.0.0.

If you are using a version of Node.js lower than this (for example the minimum supported node version v18.0.0), you may need to enable Web Crypto API via the --experimental-webcrypto flag in the start and dev scripts of your package.json file.

Instead of using the experimental flag, you may use the following polyfill:

// polyfill.cjs
globalThis.crypto ??= require("crypto").webcrypto

And then import it within a top-level file in the application:

// server.ts
import "./polyfill.cjs"

About

Example showing how to use Auth.js with Express.

Topics

Resources

Readme

License

ISC license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy

Stars

Watchers

Forks

Sponsor this project

Contributors 2