fix(docs): clean up v5 migration intro

This commit is contained in:
ndom91
2023-05-07 14:30:01 +02:00
parent 39691313fb
commit 657dd57ef7

View File

@@ -2,14 +2,30 @@
title: Upgrade Guide (v5)
---
Auth.js version 5 includes a few breaking changes from the last major version (4.x). So we're here to help you upgrade your applications as smoothly as possible. It should be possible to upgrade from any version of 4.x to the latest 5 release by following the next few migration steps.
NextAuth.js version 5 will continue to be shipped as `next-auth` *for the Next.js version only*. We're here to help you upgrade your applications as smoothly as possible. It is possible to upgrade from any version of 4.x to the latest v5 release by following the migration steps below.
You can upgrade to the new version by running:
Upgrade to the latest version by running:
```bash npm2yarn2pnpm
npm install next-auth
```
## Getting Started
Below is a summary of the high-level API changes in `next-auth` v5.
```
| Where | Old | New |
| ------------------------- | --------------------------------------------------- | -------------- |
| API Route (Node) | getServerSession(req, res, authOptions) | auth() wrapper |
| API Route (Edge) | - | auth() wrapper |
| getServerSideProps | getServerSession(ctx.req, ctx.res, authOptions) | auth() wrapper |
| Middleware | withAuth(middleware, subset of authOptions) wrapper | auth() wrapper |
| Route Handler | - | auth() wrapper |
| Server Component | getServerSession(authOptions) | auth() call |
| Client Component | useSession() hook | useAuth() hook |
```
## Summary