-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] kakao 로그인시 회원 가입 기능 추가 #86
Changes from all commits
e8969c7
f40807b
94364bb
2d1ba00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,9 @@ interface KakaoProfile extends Profile { | |
id: number; | ||
_json: { | ||
id: number; | ||
kakao_account: { | ||
email: string; | ||
}; | ||
}; | ||
} | ||
|
||
|
@@ -44,7 +47,10 @@ export class KakaoStrategy extends PassportStrategy<Strategy>( | |
try { | ||
// eslint-disable-next-line no-underscore-dangle | ||
const kakaoId = profile._json.id; | ||
// eslint-disable-next-line no-underscore-dangle | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 이런 린트 규칙 오류는 바로바로 추가하셔도 괜찮을 거 같아요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 맞아요! 그래서 정말 넣기 싫었지만 어쩔 수 없이 ignore 하고 있습니다 ㅠ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 린트 규칙에 바로 추가하셔서 깃에 올리셔도 될 거 같아요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여긴 특수한 경우지만 보통의 경우엔 __ 쓰는건 지양해야할 거 같아서 린트 규칙에 추가하진 않았는데 추가할까요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 다른 외부 API 사용할 때도 저런 이슈가 발생하면 ignore 한줄 한줄 또 써야 하니.. 이번 프로젝트에서는 off 해도 괜찮을 것 같습니다. |
||
const { email } = profile._json.kakao_account; | ||
const user = { | ||
email, | ||
kakaoId, | ||
}; | ||
done(null, user); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,8 @@ export class User extends BaseEntity { | |
@Column({ default: false }) | ||
tutorial: boolean; | ||
|
||
@Column({ default: -1 }) | ||
kakaoId: number; | ||
@Column({ default: '' }) | ||
kakaoId: string; | ||
|
||
@Column({ default: '' }) | ||
currentRefreshToken: string; | ||
|
@@ -25,7 +25,7 @@ export class User extends BaseEntity { | |
currentRefreshTokenExpiresAt: Date; | ||
|
||
toAuthCredentialsDto(): AuthCredentialsDto { | ||
if (this.kakaoId === -1) { | ||
if (this.kakaoId === '') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 비어있는 문자열은 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 엇 그런가요? 저는 몰랐던 내용이라.. 이후에 리팩토링할 때 차차 수정해보겠습니다. 감사합니다! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 명시적으로 저렇게 나타내주시는 분들도 많더라구요! 딱히 수정할 필요는 없어보이지만, 만약에 db에서 kakaoId가 nullable한 값이다! 이런거면 이런 식으로 if문으로 체크 했을 때 빈문자열도 null 같은 친구들이랑 동일하게 false 값으로 나와서 제가 말씀드린거처럼 확인이 가능합니다! |
||
return { | ||
email: this.email, | ||
password: this.password, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 맞다 이거 말씀드리려 했는데 깜빡했네요!!
authCredentialsDto를 카카오 로그인에서도 사용하고 일반 로그인에서도 사용하는 걸로 알고 있는데 의도하신 부분 맞을까요?
저희 스웨거 보니까 아래처럼 떠서 질문드려요...!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아..! 잘못 이해 했는데 둘다 똑같은 Dto를 사용하고 있긴 합니다..! 뭔가 swagger 상에서 보면 이상하긴 하네요