     callback null, session
 
 
-fetchSession = (Models, token, callback) ->
+fetchSession = (Models, options, callback) ->
+
+  { token } = options
+
+  unless token
+
+    Models.JSession.createSession options, (err, res) ->
+      if err or not res?.session
+        return callback apiErrors.unauthorizedRequest
+
+      callback null, res.session
+
+    return
 
   Models.JSession.one { clientId: token }, (err, session) ->
 

    sendApiError res, apiErrors.invalidInput
    return

  if not token and not token = getToken req
    sendApiError res, apiErrors.unauthorizedRequest
    return

  return { model, id, method, token }


    return  unless parsedRequest = parseRequest req, res
    { model, id, method, token } = parsedRequest

    options = {}
    options.token = token   if token
    options.group = req.body.groupName
    customContext = req.body.username

    if "#{model}.#{method}" is 'JUser.login'
      if not options.group or not customContext
        sendApiError res, apiErrors.invalidInput
        return

    else if not token
      sendApiError res, apiErrors.unauthorizedRequest
      return

    fetchSession Models, options, (err, session) ->

      if err
        sendApiError res, err
