Fix next-auth

This commit is contained in:
Jared Palmer 2023-06-21 14:29:19 -07:00
parent 28f62d80cf
commit f2ae20d26b
5 changed files with 26 additions and 44 deletions

16
auth.ts
View file

@ -1,16 +1,26 @@
import NextAuth from 'next-auth' import NextAuth, { type DefaultSession } from 'next-auth'
import GitHub from 'next-auth/providers/github' import GitHub from 'next-auth/providers/github'
declare module 'next-auth' {
/**
* Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
*/
interface Session {
user: {
/** The user's postal address. */
id: string
} & DefaultSession['user']
}
}
export const { export const {
handlers: { GET, POST }, handlers: { GET, POST },
auth, auth,
CSRF_experimental CSRF_experimental
// @ts-ignore
} = NextAuth({ } = NextAuth({
// @ts-ignore // @ts-ignore
providers: [GitHub], providers: [GitHub],
callbacks: { callbacks: {
// @ts-ignore
jwt: async ({ token, profile }) => { jwt: async ({ token, profile }) => {
if (profile?.id) { if (profile?.id) {
token.id = profile.id token.id = profile.id

13
next-auth.d.ts vendored
View file

@ -1,13 +0,0 @@
import NextAuth, { DefaultSession } from 'next-auth'
declare module 'next-auth' {
/**
* Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
*/
interface Session {
user: {
/** The user's postal address. */
id: string
} & DefaultSession['user']
}
}

View file

@ -33,7 +33,7 @@
"focus-trap-react": "^10.1.1", "focus-trap-react": "^10.1.1",
"nanoid": "^4.0.2", "nanoid": "^4.0.2",
"next": "13.4.7-canary.1", "next": "13.4.7-canary.1",
"next-auth": "0.0.0-manual.4cd21ea5", "next-auth": "0.0.0-manual.e65faa1c",
"next-themes": "^0.2.1", "next-themes": "^0.2.1",
"openai-edge": "^0.5.1", "openai-edge": "^0.5.1",
"react": "^18.2.0", "react": "^18.2.0",
@ -67,10 +67,5 @@
"tailwindcss-animate": "^1.0.5", "tailwindcss-animate": "^1.0.5",
"typescript": "^5.1.3" "typescript": "^5.1.3"
}, },
"pnpm": {
"overrides": {
"@auth/nextjs": "0.0.0-manual.223c6467"
}
},
"packageManager": "pnpm@8.6.1" "packageManager": "pnpm@8.6.1"
} }

26
pnpm-lock.yaml generated
View file

@ -4,9 +4,6 @@ settings:
autoInstallPeers: true autoInstallPeers: true
excludeLinksFromLockfile: false excludeLinksFromLockfile: false
overrides:
'@auth/nextjs': 0.0.0-manual.223c6467
dependencies: dependencies:
'@radix-ui/react-alert-dialog': '@radix-ui/react-alert-dialog':
specifier: ^1.0.4 specifier: ^1.0.4
@ -66,8 +63,8 @@ dependencies:
specifier: 13.4.7-canary.1 specifier: 13.4.7-canary.1
version: 13.4.7-canary.1(react-dom@18.2.0)(react@18.2.0) version: 13.4.7-canary.1(react-dom@18.2.0)(react@18.2.0)
next-auth: next-auth:
specifier: 0.0.0-manual.4cd21ea5 specifier: 0.0.0-manual.e65faa1c
version: 0.0.0-manual.4cd21ea5(next@13.4.7-canary.1)(react-dom@18.2.0)(react@18.2.0) version: 0.0.0-manual.e65faa1c(next@13.4.7-canary.1)(react-dom@18.2.0)(react@18.2.0)
next-themes: next-themes:
specifier: ^0.2.1 specifier: ^0.2.1
version: 0.2.1(next@13.4.7-canary.1)(react-dom@18.2.0)(react@18.2.0) version: 0.2.1(next@13.4.7-canary.1)(react-dom@18.2.0)(react@18.2.0)
@ -168,8 +165,8 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true dev: true
/@auth/core@0.8.2: /@auth/core@0.0.0-manual.8fcd46b0:
resolution: {integrity: sha512-swqJ7tKFlqiYIl1znFGrrawUv1F6rwL+/f3DoeWDaZLnr2phiHFaZsvNvLK7WBJhnJbel78Vd3GznuR31AnFUw==} resolution: {integrity: sha512-KuhvZ0hHz6NvMAgAi+su0dJOD0YAiOWGaLswyfGK5RsG/cdhqyyiII9HOTaZbWZAKir0UGYb8SlN+owhV30JXg==}
peerDependencies: peerDependencies:
nodemailer: ^6.8.0 nodemailer: ^6.8.0
peerDependenciesMeta: peerDependenciesMeta:
@ -184,13 +181,13 @@ packages:
preact-render-to-string: 5.2.3(preact@10.11.3) preact-render-to-string: 5.2.3(preact@10.11.3)
dev: false dev: false
/@auth/nextjs@0.0.0-manual.223c6467(next@13.4.7-canary.1)(react@18.2.0): /@auth/nextjs@0.0.0-manual.b53ca00b(next@13.4.7-canary.1)(react@18.2.0):
resolution: {integrity: sha512-nO6TMZ67ysq5lwpffQofxVLlTDHBLYX2x6VNXCXqbOoapofAk1qKyJ57lelHQdgV3py6qqWej/bTa4fDL19IDw==} resolution: {integrity: sha512-g0XvlP+3MSXPX512K6Hu0mGOkb1QPCkXkaA0Zr9i+bmTEDU9TtYTTNmX2EyvLeTfmrEEU/CMS92aWTmiki1KVA==}
peerDependencies: peerDependencies:
next: ^13.4.2 next: ^13.4.6
react: ^18.2.0 react: ^18.2.0
dependencies: dependencies:
'@auth/core': 0.8.2 '@auth/core': 0.0.0-manual.8fcd46b0
next: 13.4.7-canary.1(react-dom@18.2.0)(react@18.2.0) next: 13.4.7-canary.1(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0 react: 18.2.0
transitivePeerDependencies: transitivePeerDependencies:
@ -4145,8 +4142,8 @@ packages:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
dev: true dev: true
/next-auth@0.0.0-manual.4cd21ea5(next@13.4.7-canary.1)(react-dom@18.2.0)(react@18.2.0): /next-auth@0.0.0-manual.e65faa1c(next@13.4.7-canary.1)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-qzsrs2xeopmIYUz1C+FbudBIoNI7xSTd1xWeECr/Qa4NFzbCt8Dr9tb2Yocpa5jnRpk0xN96HwsJqimOYVjtRg==} resolution: {integrity: sha512-I51GvhZhZEf/gzhiTKivYPAIyZ74sCF3YXAMMuZ/bjahybeehPEu7opcPEA+H0Uxrvmo2G8/BQ7mT+TiFdM9IQ==}
peerDependencies: peerDependencies:
next: ^13.4.5 next: ^13.4.5
nodemailer: ^6.6.5 nodemailer: ^6.6.5
@ -4156,8 +4153,7 @@ packages:
nodemailer: nodemailer:
optional: true optional: true
dependencies: dependencies:
'@auth/core': 0.8.2 '@auth/nextjs': 0.0.0-manual.b53ca00b(next@13.4.7-canary.1)(react@18.2.0)
'@auth/nextjs': 0.0.0-manual.223c6467(next@13.4.7-canary.1)(react@18.2.0)
next: 13.4.7-canary.1(react-dom@18.2.0)(react@18.2.0) next: 13.4.7-canary.1(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0(react@18.2.0) react-dom: 18.2.0(react@18.2.0)

View file

@ -24,12 +24,6 @@
], ],
"strictNullChecks": true "strictNullChecks": true
}, },
"include": [ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"next-env.d.ts",
"next-auth.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }