Skip to content

Commit

Permalink
[QA-340] 액세스 토큰 만료기간 1년 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
stae1102 committed Aug 13, 2024
1 parent 391e2b5 commit 92135b4
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 92135b4

Please sign in to comment.