Skip to content

Commit

Permalink
Merge pull request #459 from yaongmeow/be-feature/#458-fix-apple-login
Browse files Browse the repository at this point in the history
[fix] LoginStrategy์—์„œ email ํ•„๋“œ ์„ ํƒ์  ๋ฐ˜ํ™˜์œผ๋กœ ์ „ํ™˜
  • Loading branch information
kmi0817 authored May 22, 2024
2 parents caa50cd + 330e809 commit e9d9163
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion BE/src/socialLogin/apple-login-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ export class AppleLoginStrategy implements SocialLoginStrategy {

async login(
socialLoginRequestDto: SocialLoginRequestDto
): Promise<{ resourceId: string; email: string }> {
): Promise<{ resourceId: string; email?: string }> {
try {
const { idToken, email } = socialLoginRequestDto;
const resourceId = (await this.decodeIdToken(idToken)).sub;
if (!email) {
return { resourceId };
}
return { resourceId, email };
} catch (error) {
throw new UnauthorizedException('์œ ํšจํ•˜์ง€ ์•Š์€ ํ˜•์‹์˜ ํ† ํฐ์ž…๋‹ˆ๋‹ค.');
Expand Down
2 changes: 1 addition & 1 deletion BE/src/socialLogin/social-login-strategy.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SocialLoginRequestDto } from './dto/social-login-request.dto';
export interface SocialLoginStrategy {
login(
socialLoginRequestDto: SocialLoginRequestDto
): Promise<{ resourceId: string; email: string }>;
): Promise<{ resourceId: string; email?: string }>;
withdraw(
resourceId: string,
socialWithdrawRequestDto: SocialWithdrawRequestDto
Expand Down

0 comments on commit e9d9163

Please sign in to comment.