Skip to content

Commit

Permalink
Merge pull request #343 from Quickchive/feat/QA-340/expand-accesss-to…
Browse files Browse the repository at this point in the history
…ken-expiration

[QA-340] 액세스 토큰 만료기간 1년 설정
  • Loading branch information
stae1102 authored Aug 13, 2024
2 parents fde3043 + 92135b4 commit 33e8f38
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,21 @@ export class AuthService {
private readonly redisService: RedisService,
) {}

async jwtLogin({
email,
password,
auto_login,
}: LoginBodyDto): Promise<LoginOutput> {
async jwtLogin({ email, password }: LoginBodyDto): Promise<LoginOutput> {
try {
const autoLogin = true;
const { user } = await this.validateUser({ email, password });
const payload: Payload = this.jwtService.createPayload(
email,
auto_login,
autoLogin,
user.id,
);
const refreshToken = await this.jwtService.generateRefreshToken(payload);

await this.redisService.set(
`${REFRESH_TOKEN_KEY}:${user.id}`,
refreshToken,
auto_login
? refreshTokenExpirationInCache
: refreshTokenExpirationInCacheShortVersion,
refreshTokenExpirationInCache,
);

return {
Expand Down

0 comments on commit 33e8f38

Please sign in to comment.