Skip to content
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/#417] RefreshToken Redis 저장 #424

Merged
merged 4 commits into from
Dec 9, 2023
Merged

Conversation

namewhat99
Copy link
Collaborator

이슈

체크리스트

  • RefreshToken redis 저장 , 확인
  • 회원탈퇴 accessToken 블랙리스트

고민한 내용

  • 회원탈퇴하면 accessToken 블랙리스트 등록
  • RefreshToken redis 등록

스크린샷

@namewhat99 namewhat99 added review code-review BE BE 관련 login 로그인 labels Dec 9, 2023
@namewhat99 namewhat99 requested a review from koomin1227 December 9, 2023 13:08
@namewhat99 namewhat99 self-assigned this Dec 9, 2023
const refreshToken = this.generateRefreshToken(user);
return { access_token: accessToken, refresh_token: refreshToken };

if ((await this.cacheManager.get(user.user_hash)) === refreshtoken) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redis에 저장된 refesh token만 사용할 수 있게 되었네요

await this.cacheManager.set(
user.user_hash,
refreshToken,
60 * 60 * 24 * 2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

환경변수로 하면 더 좋을 것 같네요~

const userPk = await this.checkAuth(id, userId);
const decodedToken: any = jwt.decode(accessToken);
if (decodedToken && decodedToken.exp) {
await this.fcmHandler.removeRegistrationToken(decodedToken.userId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유저 탈퇴할 때 registration token 삭제는 까먹었는데 넣어주셔서 감사합니다

@koomin1227 koomin1227 merged commit 625c139 into BE Dec 9, 2023
1 check passed
@koomin1227 koomin1227 deleted the BE-refreshTokenRedis-#417 branch December 9, 2023 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE BE 관련 login 로그인 review code-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants