mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
fix(docs): clean up v5 migration intro
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user