mirror of
https://github.com/steedos/steedos-platform
synced 2024-11-23 09:26:24 +00:00
16 lines
326 B
CoffeeScript
16 lines
326 B
CoffeeScript
Fiber = require('fibers');
|
|
|
|
JsonRoutes.Middleware.authenticateMeteorUser = (req, res, next)->
|
|
|
|
Fiber(()->
|
|
if !req.userId
|
|
userId = Steedos.getUserIdFromAccessToken(req.query?.access_token);
|
|
|
|
if not userId
|
|
userId = Steedos.getUserIdFromAuthToken(req, res);
|
|
|
|
if userId
|
|
req.userId = userId;
|
|
|
|
next();
|
|
).run() |