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

chore(docs): fix missing settings #10981

Merged
merged 4 commits into from
May 29, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ export function SetupCode({ providerId, providerName, highlight }: Props) {
return (
<Code>
<Code.Next>
In Next.js we recommend setting up your configuration in a file in the root of your repository, like at{" "}
<code>auth.ts</code>.
<br />
<Pre
data-filename="@/auth"
data-filename="./auth.ts"
data-theme="default"
data-copy=""
data-language="tsx"
Expand All @@ -23,15 +26,32 @@ export function SetupCode({ providerId, providerName, highlight }: Props) {
import NextAuth from "next-auth"
import ${providerName} from "next-auth/providers/${providerId}"

export const { signIn, signOut, auth } = NextAuth({
export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [${providerName}],
})`),
}}
/>
<br />
Add the <code>handlers</code> which <code>NextAuth</code> returns to
your <code>api/auth/[...nextauth]/route.ts</code> file so that Auth.js
can run on any incoming request.
<Pre
data-filename="./app/api/auth/[...nextauth]/route.ts"
data-theme="default"
data-copy=""
data-language="tsx"
icon={TSIcon}
dangerouslySetInnerHTML={{
__html: highlight(`
import { handlers } from "@/auth"
export const { GET, POST } = handlers
`),
}}
/>
</Code.Next>
<Code.Svelte>
In SvelteKit you should also setup your Auth.js configuration in a file
at `/src/auth.ts`.
at <code>/src/auth.ts</code>.
<br />
<Pre
data-filename="./src/auth.ts"
Expand All @@ -44,7 +64,7 @@ export const { signIn, signOut, auth } = NextAuth({
import { SvelteKitAuth } from "@auth/sveltekit"
import ${providerName} from "@auth/sveltekit/providers/${providerId}"

export const { handle } = SvelteKitAuth({
export const { handle, signIn } = SvelteKitAuth({
providers: [${providerName}],
}) `),
}}
Expand Down
Loading