Skip to content

Commit 8ba9442

Browse files
refactor: preserve some next-auth v4 functionality (#9617)
* refactor: drop `types` submodule * refactor: drop `@internal` from `getCsrfToken` and `getProviders` * refactor: re-export types from `@auth/core` * refactor: re-export `@auth/core/jwt`
1 parent 6962047 commit 8ba9442

File tree

5 files changed

+6
-32
lines changed

5 files changed

+6
-32
lines changed

packages/next-auth/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
"types": "./react.d.ts",
4141
"import": "./react.js"
4242
},
43-
"./types": {
44-
"types": "./types.d.ts"
45-
},
4643
"./package.json": "./package.json"
4744
},
4845
"keywords": [

packages/next-auth/src/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ import type { NextAuthConfig, NextAuthRequest } from "./lib/index.js"
6666
export { AuthError } from "@auth/core/errors"
6767

6868
export type {
69+
Session,
6970
Account,
70-
DefaultSession,
7171
Profile,
72-
Session,
72+
DefaultSession,
7373
User,
74-
} from "./types.js"
74+
} from "@auth/core/types"
7575

7676
type AppRouteHandlers = Record<
7777
"GET" | "POST",

packages/next-auth/src/jwt.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
/**
2-
* :::warning Deprecated
3-
* This module is replaced in v5. Read more at: https://authjs.dev/guides/upgrade-to-v5#authenticating-server-side
2+
* :::warning Not recommended
3+
* In NextAuth.js v5 or newer, we recommend other authentication methods server-side. Read more at: https://authjs.dev/guides/upgrade-to-v5#authenticating-server-side
44
* :::
55
*
66
* @module jwt
77
*/
88

9-
throw new ReferenceError(
10-
[
11-
'"next-auth/jwt" is deprecated. If you are not ready to migrate, keep using "next-auth@4".',
12-
"Read more on https://authjs.dev/guides/upgrade-to-v5",
13-
].join("\n")
14-
)
15-
16-
export {}
9+
export * from "@auth/core/jwt"

packages/next-auth/src/react.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ export async function getSession(params?: GetSessionParams) {
184184
* required to make requests that changes state. (e.g. signing in or out, or updating the session).
185185
*
186186
* [CSRF Prevention: Double Submit Cookie](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#double-submit-cookie)
187-
* @internal
188187
*/
189188
export async function getCsrfToken() {
190189
const response = await fetchData<{ csrfToken: string }>(
@@ -203,7 +202,6 @@ type ProvidersType = Record<
203202
/**
204203
* Returns a client-safe configuration object of the currently
205204
* available providers.
206-
* @internal
207205
*/
208206
export async function getProviders() {
209207
return fetchData<ProvidersType>("providers", __NEXTAUTH, logger)

packages/next-auth/src/types.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)