Kakao 로그인(카카오 SDK · 서버 커스텀 토큰)과 LINE 로그인(Firebase OIDC) 연결 · SNS 연동 · 인증 취소 처리

This commit is contained in:
Sn-Kinos
2026-10-05 19:01:28 +09:00
parent f483e8d94b
commit c301f3a1db
23 changed files with 1179 additions and 53 deletions
+9 -4
View File
@@ -9,6 +9,9 @@ import { HttpsError } from 'firebase-functions/v2/https';
export const ERR = {
permissionDenied: 'E-PERM-01',
authFailed: 'E-AUTH-03',
// 계정 연결(SNS 연동) — 앱 auth 카탈로그와 같은 ID. 08 은 「다른 계정에 이미 연결」·「다른 이메일」 둘 다다.
authCredentialInUse: 'E-AUTH-08',
authAlreadyLinked: 'E-AUTH-09',
} as const;
export type ErrorCode = (typeof ERR)[keyof typeof ERR];
@@ -20,12 +23,14 @@ type Status = 'invalid-argument' | 'failed-precondition' | 'already-exists'
const STATUS: Record<ErrorCode, Status> = {
'E-PERM-01': 'permission-denied',
'E-AUTH-03': 'permission-denied',
'E-AUTH-08': 'already-exists',
'E-AUTH-09': 'already-exists',
};
/** 카탈로그 ID 를 그대로 실은 오류. `details.code` 가 계약면이다. */
export class CatalogError extends HttpsError {
constructor(readonly catalogCode: ErrorCode, message: string) {
super(STATUS[catalogCode], message, { code: catalogCode });
constructor(readonly catalogCode: ErrorCode, message: string, extra: Record<string, unknown> = {}) {
super(STATUS[catalogCode], message, { ...extra, code: catalogCode });
}
}
@@ -36,8 +41,8 @@ export class CatalogError extends HttpsError {
* => {...}` 형태로는 호출 이후를 도달 불가로 좁히지 못한다. 그러면 호출 뒤의
* 코드가 「값이 없을 수도 있다」로 남아 불필요한 널 검사가 번진다.
*/
export function fail(code: ErrorCode, message: string): never {
throw new CatalogError(code, message);
export function fail(code: ErrorCode, message: string, extra?: Record<string, unknown>): never {
throw new CatalogError(code, message, extra);
}
/**