Skip to content

feat(nextjs): introduce next-auth v5#7443

Merged
balazsorban44 merged 339 commits into
mainfrom
feat/nextjs-auth
Oct 24, 2023
Merged

feat(nextjs): introduce next-auth v5#7443
balazsorban44 merged 339 commits into
mainfrom
feat/nextjs-auth

Conversation

@balazsorban44

@balazsorban44 balazsorban44 commented May 4, 2023

Copy link
Copy Markdown
Contributor

Next.js 13.4 is out.

For discussing project-related issues, please use #8487

The new version of NextAuth.js is based on @auth/core.

If you want to test it out, you can do so already, installing next-auth@experimental:

BREAKING CHANGES

Follow the migration guide

@vercel

vercel Bot commented May 4, 2023

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 4 unresolved
✅ 24 resolved
Oct 23, 2023 11:52pm
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
auth-docs-nextra ⬜️ Ignored (Inspect) Visit Preview Oct 23, 2023 11:52pm
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Oct 23, 2023 11:52pm

return (...args: WithAuthArgs) => {
if (!args.length) {
// React Server Components
return getSession(headers(), config).then((r) => r.json())

@ryanagillie ryanagillie Oct 11, 2023

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Wondering if this return getSession should be abstracted out into a cache() call so that if it's called from multiple server components it only does the fetching once per request?

@ryanagillie ryanagillie Oct 11, 2023

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A pattern I've seen recently with v4 is to re-export a wrapped getServerSession in a cache() call to get the same effect

import { type NextAuthOptions, getServerSession as naGetServerSession } from "next-auth"
import { cache } from "react";

export const config: NextAuthOptions = { ... };

export const getServerSession = cache(() => naGetServerSession(config));

@greenhat616

greenhat616 commented Oct 17, 2023

Copy link
Copy Markdown

Hello, i want to know that all callbacks should defined in auth.js as the props of auth func. If i import sth, including node-gyp, like argon2 in this file, and middleware.ts imported auth.ts, thus a next.js crash will occurred, like vercel/next.js#46493.

Does anybody has workaround for it? Is it a next.js issue?

@vercel

vercel Bot commented Mar 19, 2024

Copy link
Copy Markdown

Deployment failed with the following error:

Creating the Deployment Timed Out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples legacy Refers to `next-auth` v4. Minimal maintenance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.