diff --git a/server/middleware/token.js b/server/middleware/token.js index b5038df2..21e3b5ca 100644 --- a/server/middleware/token.js +++ b/server/middleware/token.js @@ -124,7 +124,7 @@ function token(options) { TokenModel.findForRequest(req, options, function(err, token) { req.accessToken = token || null; rewriteUserLiteral(req, currentUserLiteral); - var ctx = loopback.getCurrentContext(); + var ctx = req.loopbackContext; if (ctx) ctx.set('accessToken', token); next(err); });