# How to add authentication to Next.js without creating an account

DevFeed: [How to add authentication to Next.js without creating an account](<https://devfeed.tech/articles/how-to-add-authentication-to-next-js-without-creating-an-account-123471.md>)

Original publisher: [Read original article](<https://workos.com/blog/add-authentication-nextjs-without-account>)

Author: WorkOS

Published: 2026-11-09T00:00:00Z

Content type: tutorial

Language: en

Sources: [WorkOS](<https://devfeed.tech/sources/workos-blog.md>)

Topics: [Authentication](<https://devfeed.tech/topics/authentication.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [Node.js](<https://devfeed.tech/topics/node-js.md>), [self-service](<https://devfeed.tech/topics/self-service.md>)

Tags: [authentication](<https://devfeed.tech/tags/authentication.md>), [cli](<https://devfeed.tech/tags/cli.md>), [environment](<https://devfeed.tech/tags/environment.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [next-js](<https://devfeed.tech/tags/next-js.md>), [sign-in](<https://devfeed.tech/tags/sign-in.md>), [workos](<https://devfeed.tech/tags/workos.md>)

## AI overview

Run `npx workos@latest install` in a Next.js 15.3+ app to add AuthKit sign-in, sign-out, callback routing, and session handling without first creating a WorkOS account. With no existing `WORKOS_API_KEY`, the CLI provisions a temporary environment and writes credentials to `.env.local`; it detects the Next.js version and router, and keeps existing keys if found. Review the CLI's changes on its branch; it does not stage, commit, or push them. Unclaimed environments work for testing but expire after 7 days. To keep one, claim it through the CLI and WorkOS dashboard; claiming is permanent. Then log in to the CLI, remove `WORKOS_CLAIM_TOKEN`, and configure a separate production environment before shipping. The excerpt also describes agent mode, which avoids interactive prompts and supports JSON/NDJSON output and claim links. Setup requires a clean Git working tree.

## Source excerpt

Run one command to add sign-in to a Next.js app. The WorkOS CLI creates a temporary environment and writes your keys. Claim it when you want to keep it.