Skip to content

Commit

Permalink
update/ refresh request returns only 403
Browse files Browse the repository at this point in the history
  • Loading branch information
dev2820 committed Sep 2, 2023
1 parent 7d0f51b commit 3899ded
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/middlewares/credential/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const checkRefreshTokenExist = (
refreshToken?: string
): { refreshToken: string } => {
if (isNil(refreshToken)) {
throw new StatusError(401, 'Token not exist');
throw new StatusError(403, 'Token not exist');
}

return { refreshToken };
Expand All @@ -28,7 +28,7 @@ export const checkVerifedToken = ({
const decoded = Auth.decodeRefreshToken(refreshToken);

if (isString(decoded)) {
throw new StatusError(401, `Failed to validate token: ${decoded}`);
throw new StatusError(403, `Failed to validate token: ${decoded}`);
}

return {
Expand All @@ -39,7 +39,7 @@ export const checkVerifedToken = ({

export const checkPayloadSatisfied = ({ payload, originToken }: TokenInfo) => {
if (!Auth.isPayloadSatisfied(payload)) {
throw new StatusError(401, 'payload is wrong');
throw new StatusError(403, 'payload is wrong');
}

return { payload, originToken };
Expand Down

0 comments on commit 3899ded

Please sign in to comment.