Skip to content

Commit

Permalink
Merge pull request #14 from moevm/kharitonov_bug-fixes
Browse files Browse the repository at this point in the history
Bearer token bug fix
  • Loading branch information
necitboss authored Nov 10, 2024
2 parents 62db372 + ce4860e commit 7189b7f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main/utils/checkAuth.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import jwt from "jsonwebtoken"

export default (req, res) => {
export default (req, res, next) => {
const token = (req.headers.authorization || '')
.replace(/Brarer\s?/, '');
.replace(/Bearer\s?/, '');
const msg = 'Нет доступа';
if (token){
try {
const decoded = jwt.verify(token, 'secret2314');
req.adminId = decoded.id;
// req.adminId = decoded.id;
next();
} catch (err) {
return res.status(403).json({
Expand Down

0 comments on commit 7189b7f

Please sign in to comment.