Skip to content
This repository was archived by the owner on Sep 4, 2024. It is now read-only.

Commit 9f7af26

Browse files
Updated auth middleware
1 parent 95df6b7 commit 9f7af26

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

middleware/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Users, { User } from '../models/users';
66
export default async function AuthMiddleware(req: Request, res: Response, next: NextFunction) {
77
let header = req.get('Authorization') as string;
88
if (!/^Bearer (.+)$/i.test(header)) { // Bearer token is not present
9-
return AuthenticationError(res, "Bad/Expired token.");
9+
return AuthenticationError(res, "Bad token.");
1010
}
1111

1212
// Extract user ID from bearer token
@@ -23,7 +23,7 @@ export default async function AuthMiddleware(req: Request, res: Response, next:
2323
if (user == null) {
2424
throw new Error('User is not Authenticated.');
2525
} else if (await Users.checkUserHasAuthToken(user.id, token)) {
26-
throw new Error('Bad/Expired auth token.');
26+
throw new Error('Expired auth token.');
2727
}
2828
} catch (e) {
2929
return AuthenticationError(res, (e as Error).message);

0 commit comments

Comments
 (0)