Skip to content

Commit 89012bd

Browse files
k-taro56ndom91
andauthored
chore(docs): fix missing settings (#10981)
Co-authored-by: Nico Domino <[email protected]>
1 parent ae42813 commit 89012bd

File tree

1 file changed

+24
-4
lines changed
  • docs/components/OAuthProviderInstructions/content/components

1 file changed

+24
-4
lines changed

docs/components/OAuthProviderInstructions/content/components/SetupCode.tsx

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ export function SetupCode({ providerId, providerName, highlight }: Props) {
1212
return (
1313
<Code>
1414
<Code.Next>
15+
In Next.js we recommend setting up your configuration in a file in the root of your repository, like at{" "}
16+
<code>auth.ts</code>.
17+
<br />
1518
<Pre
16-
data-filename="@/auth"
19+
data-filename="./auth.ts"
1720
data-theme="default"
1821
data-copy=""
1922
data-language="tsx"
@@ -23,15 +26,32 @@ export function SetupCode({ providerId, providerName, highlight }: Props) {
2326
import NextAuth from "next-auth"
2427
import ${providerName} from "next-auth/providers/${providerId}"
2528
26-
export const { signIn, signOut, auth } = NextAuth({
29+
export const { handlers, signIn, signOut, auth } = NextAuth({
2730
providers: [${providerName}],
2831
})`),
2932
}}
3033
/>
34+
<br />
35+
Add the <code>handlers</code> which <code>NextAuth</code> returns to
36+
your <code>api/auth/[...nextauth]/route.ts</code> file so that Auth.js
37+
can run on any incoming request.
38+
<Pre
39+
data-filename="./app/api/auth/[...nextauth]/route.ts"
40+
data-theme="default"
41+
data-copy=""
42+
data-language="tsx"
43+
icon={TSIcon}
44+
dangerouslySetInnerHTML={{
45+
__html: highlight(`
46+
import { handlers } from "@/auth"
47+
export const { GET, POST } = handlers
48+
`),
49+
}}
50+
/>
3151
</Code.Next>
3252
<Code.Svelte>
3353
In SvelteKit you should also setup your Auth.js configuration in a file
34-
at `/src/auth.ts`.
54+
at <code>/src/auth.ts</code>.
3555
<br />
3656
<Pre
3757
data-filename="./src/auth.ts"
@@ -44,7 +64,7 @@ export const { signIn, signOut, auth } = NextAuth({
4464
import { SvelteKitAuth } from "@auth/sveltekit"
4565
import ${providerName} from "@auth/sveltekit/providers/${providerId}"
4666
47-
export const { handle } = SvelteKitAuth({
67+
export const { handle, signIn } = SvelteKitAuth({
4868
providers: [${providerName}],
4969
}) `),
5070
}}

0 commit comments

Comments
 (0)