Skip to content

Commit

Permalink
chore: 검증 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Xvezda committed May 4, 2024
1 parent 82a0b10 commit 0a353a5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions apps/api/src/services/auth/v1/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,13 @@ const withSession: MiddlewareHandler<{
}> = async (c, next) => {
const sessionId = getCookie(c, 'session_id');
const sessionSid = getCookie(c, 'session_sid');
if (!sessionId || !sessionSid) {
deleteSessionCookies(c);
return c.json({ message: 'Unauthorized' }, 401);
}

let user;
try {
const payload = await verifyToken<SessionPayload>(c, sessionId);
const payload = await verifyToken<SessionPayload>(c, sessionId ?? '');
user = payload['http:cheda.kr/user'];
} catch (e) {
const securedToken = await decryptToken(c, sessionSid);
const securedToken = await decryptToken(c, sessionSid ?? '');
const securedPayload = await verifyToken<SecuredSessionPayload>(c, securedToken);
const { refreshToken } = securedPayload['http:cheda.kr/user'];

Expand Down

0 comments on commit 0a353a5

Please sign in to comment.