File tree Expand file tree Collapse file tree
Firebase/functions/src/auth Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ interface GitHubEmail {
2626 verified : boolean ;
2727}
2828
29+ const GITHUB_EMAIL_UNAVAILABLE_REASON = "email_not_found" ;
30+
2931// GitHub OAuth 인증 및 커스텀 토큰 발급 함수
3032export const requestGithubTokens = onCall ( {
3133 cors : true ,
@@ -75,7 +77,11 @@ export const requestGithubTokens = onCall({
7577 const email = await resolveGitHubEmail ( accessToken , userData . email ) ;
7678
7779 if ( ! userData . id || ! email ) {
78- throw new HttpsError ( 'internal' , 'GitHub 사용자 데이터를 가져오지 못했습니다.' ) ;
80+ throw new HttpsError (
81+ 'internal' ,
82+ 'GitHub 사용자 데이터를 가져오지 못했습니다.' ,
83+ { reason : GITHUB_EMAIL_UNAVAILABLE_REASON }
84+ ) ;
7985 }
8086
8187 // 3. Firebase에서 GitHub 제공자로 사용자를 찾거나 생성
@@ -106,6 +112,9 @@ export const requestGithubTokens = onCall({
106112 } ;
107113 } catch ( error ) {
108114 console . error ( 'GitHub 커스텀 토큰 생성 오류:' , error ) ;
115+ if ( error instanceof HttpsError ) {
116+ throw error ;
117+ }
109118 throw new HttpsError ( 'internal' , error instanceof Error ? error . message : '알 수 없는 오류가 발생했습니다.' ) ;
110119 }
111120} ) ;
You can’t perform that action at this time.
0 commit comments