Skip to content
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

fix(docs): modify import path #10391

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/docs/configuration/nextjs.md
Expand Up @@ -8,7 +8,7 @@ You can create a helper function so you don't need to pass `authOptions` around:
```ts title=auth.ts
import type { GetServerSidePropsContext, NextApiRequest, NextApiResponse } from "next"
import type { NextAuthOptions } from "next-auth"
import { getServerSession } from "next-auth"
import { getServerSession } from "next-auth/next"

// You'll need to import and pass this
// to `NextAuth` in `app/api/auth/[...nextauth]/route.ts`
Expand All @@ -29,8 +29,8 @@ When calling from the server-side i.e. in Route Handlers, React Server Component

In `[...nextauth].ts`:
```ts
import NextAuth from 'next-auth'
import type { NextAuthOptions } from 'next-auth'
import NextAuth from "next-auth"
import type { NextAuthOptions } from "next-auth"

export const authOptions: NextAuthOptions = {
// your configs
Expand All @@ -41,7 +41,7 @@ export default NextAuth(authOptions);

### In `getServerSideProps`:
```js
import { authOptions } from 'pages/api/auth/[...nextauth]'
import { authOptions } from "pages/api/auth/[...nextauth]"
import { getServerSession } from "next-auth/next"

export async function getServerSideProps(context) {
Expand All @@ -66,7 +66,7 @@ export async function getServerSideProps(context) {

### In API Routes:
```js
import { authOptions } from 'pages/api/auth/[...nextauth]'
import { authOptions } from "pages/api/auth/[...nextauth]"
import { getServerSession } from "next-auth/next"


Expand All @@ -90,7 +90,7 @@ You can also use `getServerSession` in Next.js' server components:

```tsx
import { getServerSession } from "next-auth/next"
import { authOptions } from "pages/api/auth/[...nextauth]"
import { authOptions } from "app/api/auth/[...nextauth]/route"

export default async function Page() {
const session = await getServerSession(authOptions)
Expand Down