Skip to content

Commit e4ee520

Browse files
authoredMay 31, 2022
fix(ts): allow getToken in getServerSideProps (#4659)
1 parent 358b80d commit e4ee520

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎packages/next-auth/src/jwt/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { EncryptJWT, jwtDecrypt } from "jose"
22
import hkdf from "@panva/hkdf"
33
import { v4 as uuid } from "uuid"
44
import { SessionStore } from "../core/lib/cookie"
5-
import type { NextApiRequest } from "next"
5+
import type { GetServerSidePropsContext, NextApiRequest } from "next"
66
import type { NextRequest } from "next/server"
77
import type { JWT, JWTDecodeParams, JWTEncodeParams, JWTOptions } from "./types"
88
import type { LoggerInstance } from ".."
@@ -38,7 +38,7 @@ export async function decode(params: JWTDecodeParams): Promise<JWT | null> {
3838

3939
export interface GetTokenParams<R extends boolean = false> {
4040
/** The request containing the JWT either in the cookies or in the `Authorization` header. */
41-
req: NextRequest | NextApiRequest
41+
req: GetServerSidePropsContext["req"] | NextRequest | NextApiRequest
4242
/**
4343
* Use secure prefix for cookie name, unless URL in `NEXTAUTH_URL` is http://
4444
* or not set (e.g. development or test instance) case use unprefixed name

0 commit comments

Comments
 (0)
Please sign in to comment.