Skip to content

Commit

Permalink
Fix: next-auth 내에서 토큰 type
Browse files Browse the repository at this point in the history
  • Loading branch information
soulchicken committed Oct 10, 2023
1 parent ff8ed89 commit a9915e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import CredentialsProvider from 'next-auth/providers/credentials';
import { credentialsLoginAPI, socialLoginAPI } from '@/utils/api/accounts';

interface CustomSession extends Session {
accessToken?: string;
refreshToken?: string;
accessToken: string | null;
refreshToken: string | null;
}

interface SessionCallback {
Expand Down Expand Up @@ -117,8 +117,8 @@ export const authOptions: NextAuthOptions = {
},

async session({ session, token }: SessionCallback) {
(session as CustomSession).accessToken = token.accessToken as string | undefined;
(session as CustomSession).refreshToken = token.refreshToken as string | undefined;
(session as CustomSession).accessToken = token.accessToken as string | null;
(session as CustomSession).refreshToken = token.refreshToken as string | null;
return session;
},

Expand Down

0 comments on commit a9915e6

Please sign in to comment.