diff --git a/src/routes/docs/tutorials/nextjs-ssr-auth/step-3/+page.markdoc b/src/routes/docs/tutorials/nextjs-ssr-auth/step-3/+page.markdoc index 3aa02c70c6..dcc0c54239 100644 --- a/src/routes/docs/tutorials/nextjs-ssr-auth/step-3/+page.markdoc +++ b/src/routes/docs/tutorials/nextjs-ssr-auth/step-3/+page.markdoc @@ -20,7 +20,7 @@ export async function createSessionClient() { .setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT) .setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT); - const session = await cookies().get("my-custom-session"); + const session = (await cookies()).get("my-custom-session"); if (!session || !session.value) { throw new Error("No session"); } diff --git a/src/routes/docs/tutorials/nextjs-ssr-auth/step-5/+page.markdoc b/src/routes/docs/tutorials/nextjs-ssr-auth/step-5/+page.markdoc index 34849fbd2b..26cd6e2de7 100644 --- a/src/routes/docs/tutorials/nextjs-ssr-auth/step-5/+page.markdoc +++ b/src/routes/docs/tutorials/nextjs-ssr-auth/step-5/+page.markdoc @@ -80,7 +80,7 @@ async function signUpWithEmail(formData) { password }); - cookies().set("my-custom-session", session.secret, { + (await cookies()).set("my-custom-session", session.secret, { path: "/", httpOnly: true, sameSite: "strict", @@ -93,4 +93,4 @@ async function signUpWithEmail(formData) { // the SignUpPage component ... ``` -The `signUpWithEmail` function is an async function that takes the form data as an argument. It uses the `createAdminClient` function to create an admin Appwrite client and then calls the `createEmailPasswordSession` method on the `account` object. This method takes the email and password as arguments and returns a session object. We then set the session secret in a cookie and redirect the user to the account page. \ No newline at end of file +The `signUpWithEmail` function is an async function that takes the form data as an argument. It uses the `createAdminClient` function to create an admin Appwrite client and then calls the `createEmailPasswordSession` method on the `account` object. This method takes the email and password as arguments and returns a session object. We then await the `cookies()` function (required in Next.js 15) to set the session secret in a secure cookie and redirect the user to the account page. diff --git a/src/routes/docs/tutorials/nextjs-ssr-auth/step-6/+page.markdoc b/src/routes/docs/tutorials/nextjs-ssr-auth/step-6/+page.markdoc index e2237820f8..b53824ffa3 100644 --- a/src/routes/docs/tutorials/nextjs-ssr-auth/step-6/+page.markdoc +++ b/src/routes/docs/tutorials/nextjs-ssr-auth/step-6/+page.markdoc @@ -22,7 +22,9 @@ async function signOut() { const { account } = await createSessionClient(); - cookies().delete("my-custom-session"); + const cookieStore = await cookies(); + + cookieStore.delete("my-custom-session"); await account.deleteSession({ sessionId: "current" }); redirect("/signup"); diff --git a/src/routes/docs/tutorials/nextjs-ssr-auth/step-7/+page.markdoc b/src/routes/docs/tutorials/nextjs-ssr-auth/step-7/+page.markdoc index eb3ddc2901..c3ca02fd03 100644 --- a/src/routes/docs/tutorials/nextjs-ssr-auth/step-7/+page.markdoc +++ b/src/routes/docs/tutorials/nextjs-ssr-auth/step-7/+page.markdoc @@ -27,7 +27,7 @@ import { OAuthProvider } from "node-appwrite"; export async function signUpWithGithub() { const { account } = await createAdminClient(); - const origin = headers().get("origin"); + const origin = (await headers()).get("origin"); const redirectUrl = await account.createOAuth2Token({ provider: OAuthProvider.Github, @@ -88,7 +88,7 @@ export async function GET(request) { secret }); - cookies().set("my-custom-session", session.secret, { + (await cookies()).set("my-custom-session", session.secret, { path: "/", httpOnly: true, sameSite: "strict", @@ -97,4 +97,4 @@ export async function GET(request) { return NextResponse.redirect(`${request.nextUrl.origin}/account`); } -``` \ No newline at end of file +```