Edit

Auth.js

Documentation about using Vike with Auth.js.

💚
This page is maintained by the community and may contain outdated information — PR welcome to improve it.

Use vike.dev/new to scaffold a new Vike app that uses Auth.js (previously known as NextAuth.js).

Examples

vite-plugin-ssr was the previous name of Vike.

process.env.NEXTAUTH_URL

To access environment variables on the client-side, such as process.env.NEXTAUTH_URL, we can use vite.config.js#define or vite.config.js#envPrefix.

⚠️
Don't add NEXTAUTH_ to envPrefix as it would leak NEXTAUTH_SECRET.

See also:

We can use process.env as usual for server (e.g. Express.js) code. (Since server code isn't processed by Vite.)

See also