 
       return
 
-    Models.JApiToken.createSessionByToken token, (err, session) ->
+    api.JApiToken.createSessionByToken token, (err, session) ->
 
       if err or not session
         return callback apiErrors.unauthorizedRequest


module.exports = RemoteHandler = (koding) ->

  Models = koding.models

  return (req, res) ->


      return  if processHookRequests req, res

      context         = getContextFromSession session
      constructorName = getConstructorName model, api

      if customContext
        context.customContext = "custom:#{customContext}"
