File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change 1
- // Wrapper for unstable_getServerSession https://next-auth.js.org/configuration/nextjs
2
-
3
1
import type { GetServerSidePropsContext } from "next" ;
4
- import { unstable_getServerSession } from "next-auth" ;
2
+ import { getServerSession } from "next-auth" ;
5
3
import { authOptions as nextAuthOptions } from "../../pages/api/auth/[...nextauth]" ;
6
4
7
5
// Next API route example - /pages/api/restricted.ts
8
6
export const getServerAuthSession = async ( ctx : {
9
7
req : GetServerSidePropsContext [ "req" ] ;
10
8
res : GetServerSidePropsContext [ "res" ] ;
11
9
} ) => {
12
- return await unstable_getServerSession ( ctx . req , ctx . res , nextAuthOptions ) ;
10
+ return getServerSession ( ctx . req , ctx . res , nextAuthOptions ) ;
13
11
} ;
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export const createContextInner = async (opts: CreateContextOptions) => {
27
27
export const createContext = async ( opts : CreateNextContextOptions ) => {
28
28
const { req, res } = opts ;
29
29
30
- // Get the session from the server using the unstable_getServerSession wrapper function
30
+ // Get the session from the server using the getServerSession wrapper function
31
31
const session = await getServerAuthSession ( { req, res } ) ;
32
32
33
33
return await createContextInner ( {
You can’t perform that action at this time.
0 commit comments