Skip to content

Update example.md #13163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/docs/getting-started/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ If you are using TypeScript, NextAuth.js comes with its types definitions within

### Add API route

To add NextAuth.js to a project create a file called `[...nextauth].js` in `pages/api/auth`. This contains the dynamic route handler for NextAuth.js which will also contain all of your global NextAuth.js configurations.
To add NextAuth.js to a project create a file called `[...nextauth]` in `pages/api/auth`. This contains the dynamic route handler for NextAuth.js which will also contain all of your global NextAuth.js configurations.

If you're using [Next.js 13.2](https://nextjs.org/blog/next-13-2#custom-route-handlers) or above with the new App Router (`app/`), you can initialize the configuration using the new [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/router-handlers) by following our [guide](https://next-auth.js.org/configuration/initialization#route-handlers-app).

```javascript title="pages/api/auth/[...nextauth].js" showLineNumbers
```javascript title="pages/api/auth/[...nextauth]" showLineNumbers
import NextAuth from "next-auth"
import GithubProvider from "next-auth/providers/github"

Expand Down Expand Up @@ -139,7 +139,7 @@ NextAuth.js allows you to hook into various parts of the authentication flow via

For example, to pass a value from the sign-in to the frontend, client-side, you can use a combination of the [`session`](/configuration/callbacks#session-callback) and [`jwt`](/configuration/callbacks#jwt-callback) callback like so:

```javascript title="pages/api/auth/[...nextauth].js"
```javascript title="pages/api/auth/[...nextauth]"
...
callbacks: {
async jwt({ token, account }) {
Expand Down