Skip to content

Commit

Permalink
feat: kakao login type 구조 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
aaahyesu committed Jan 21, 2025
1 parent 1010d88 commit 72c85c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const authOptions: NextAuthOptions = {
let nickname;
if (platformType === 'KAKAO') {
// 카카오는 항상 nickname을 제공
nickname = (profile as KakaoProfile)?.nickname;
nickname = (profile as KakaoProfile)?.properties?.nickname;
} else if (platformType === 'APPLE') {
if (appleFirstInfo?.name) {
// 애플 최초 로그인시에만 이름 정보 사용
Expand Down
28 changes: 17 additions & 11 deletions lib/types/next-auth.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ declare module 'next-auth' {
name?: string | null;
image?: string | null;
}

interface Profile extends KakaoProfile {
sub?: string;
email?: string;
name?: string;
image?: string;
}
}

export interface AppleRequest {
Expand All @@ -60,8 +53,21 @@ export interface AppleUserInfo {
lastName?: string;
};
}

export interface KakaoProfile {
nickname?: string;
[key: string]: unknown;
interface KakaoProfile {
id: number;
connected_at: string;
properties: {
nickname: string;
};
kakao_account: {
profile_nickname_needs_agreement: boolean;
profile: {
nickname: string;
};
has_email: boolean;
email_needs_agreement: boolean;
is_email_valid: boolean;
is_email_verified: boolean;
email: string;
};
}

0 comments on commit 72c85c2

Please sign in to comment.