Skip to content

Commit

Permalink
Feat: apple provider 등록
Browse files Browse the repository at this point in the history
  • Loading branch information
soulchicken committed Oct 31, 2023
1 parent 2af8960 commit 043f69e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { JWT } from 'next-auth/jwt';
import GoogleProvider from 'next-auth/providers/google';
import NaverProvider from 'next-auth/providers/naver';
import KakaoProvider from 'next-auth/providers/kakao';
import AppleProvider from 'next-auth/providers/apple';
import CredentialsProvider from 'next-auth/providers/credentials';
import { credentialsLoginAPI, refreshAccessToken, socialLoginAPI } from '@/utils/api/accounts';
import { isTokenExpired } from '@/utils/services/auth';
Expand Down Expand Up @@ -33,6 +34,10 @@ export const authOptions: NextAuthOptions = {
clientId: process.env.KAKAO_CLIENT_ID as string,
clientSecret: process.env.KAKAO_CLIENT_SECRET as string,
}),
AppleProvider({
clientId: process.env.APPLE_CLIENT_ID as string,
clientSecret: process.env.APPLE_CLIENT_SECRET as string,
}),

CredentialsProvider({
name: 'Credentials',
Expand Down Expand Up @@ -76,6 +81,8 @@ export const authOptions: NextAuthOptions = {
callbacks: {
async signIn({ user, account }) {
if (account?.type === 'credentials') return true;
console.log(user.email, user.name, account?.provider);

const data = await socialLoginAPI({
email: user.email || '',
name: user.name || '',
Expand Down

0 comments on commit 043f69e

Please sign in to comment.