Skip to content
This repository was archived by the owner on Feb 11, 2018. It is now read-only.

Commit ecd5140

Browse files
committed
fix jwt
1 parent 95839aa commit ecd5140

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/middleware.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ var checkAccessToken = function (accessToken) {
3939
var config = require('../core/config');
4040
var tokenSecret = _.get(config, 'jwt.tokenSecret');
4141
var jwt = require('jsonwebtoken');
42-
var authData = jwt.verify(accessToken, tokenSecret);
42+
try {
43+
var authData = jwt.verify(accessToken, tokenSecret);
44+
} catch (e) {
45+
reject(new AppError.Unauthorized());
46+
}
4347
var uid = _.get(authData, 'uid', null);
4448
var hash = _.get(authData, 'hash', null);
4549
if (parseInt(uid) > 0) {

0 commit comments

Comments
 (0)