Skip to content

Commit

Permalink
Fix: if no jwt is present from the headers when logging out, throw an…
Browse files Browse the repository at this point in the history
… error
  • Loading branch information
georgipavlov-7DIGIT committed Mar 7, 2024
1 parent aaa3c10 commit 2b008c8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion service/controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
invalidateRefreshToken,
} from "#queries/authTokens";

import { invalidRefreshToken } from "#utils/errors";
import { incorrectCredentials, invalidRefreshToken } from "#utils/errors";
import { getYearInMilliseconds } from "#utils/helperFunctions";
import { logoutAdminQuery } from "#queries/admins";

Expand Down Expand Up @@ -92,6 +92,7 @@ export const logoutAdmin = async ({
admin_id,
jwt: jwtFromHeaders,
}) => {
if (!jwtFromHeaders) throw incorrectCredentials(language);
const decoded = jwt.decode(jwtFromHeaders);

const isSameID = decoded.sub === admin_id;
Expand Down

0 comments on commit 2b008c8

Please sign in to comment.