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'
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 {
handlers: { GET, POST },
auth,
CSRF_experimental
// @ts-ignore
} = NextAuth({
// @ts-ignore
providers: [GitHub],
callbacks: {
// @ts-ignore
jwt: async ({ token, profile }) => {
if (profile?.id) {
token.id = profile.id