Skip to content

Commit

Permalink
Merge pull request #38 from urdego/feature/#12-login-apple
Browse files Browse the repository at this point in the history
hotfix: μ• ν”Œ 토큰 생성 정상화 ν…ŒμŠ€νŠΈ
  • Loading branch information
aaahyesu authored Jan 3, 2025
2 parents 5ffee1d + bc145e7 commit a9adb13
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SignJWT } from 'jose';
// μ• ν”Œ 토큰 생성 ν•¨μˆ˜
const getAppleToken = async () => {
const key = `-----BEGIN PRIVATE KEY-----\n${process.env.APPLE_PRIVATE_KEY}\n-----END PRIVATE KEY-----`;
return await new SignJWT({})
const token = await new SignJWT({})
.setAudience('https://appleid.apple.com')
.setIssuer(process.env.APPLE_TEAM_ID!)
.setIssuedAt(new Date().getTime() / 1000)
Expand All @@ -18,7 +18,11 @@ const getAppleToken = async () => {
kid: process.env.APPLE_KEY_ID,
})
.sign(createPrivateKey(key));

console.log('Generated Apple Client Secret:', token); // 토큰 둜그 좜λ ₯
return token;
};

// Apple 토큰을 미리 생성
const appleClientSecret = await getAppleToken();

Expand All @@ -45,7 +49,7 @@ const authOptions: NextAuthOptions = {
scope: 'name email',
response_mode: 'form_post',
response_type: 'code',
redirect_uri: '/api/auth/callback/apple',
redirect_uri: process.env.NEXTAUTH_URL + '/api/auth/callback/apple',
},
},
profile(profile) {
Expand Down

0 comments on commit a9adb13

Please sign in to comment.