解析服务器上的查询会话始终获得无效的会话令牌消息

时间:2017-01-11 06:33:10

标签: function session parse-platform cloud parse-server

我在云端有一些代码来查询解析服务器上的会话。代码在parse.com上运行正常,但是当我在parse-server上调用相同的代码时,它总是得到"invalid session token"消息。这是代码:

Parse.Cloud.define("getSessionCount", function(request, response) {
    if (request.user == null) {
        reportError("deleteAllOtherSessions", "userCheck", 0);
        response.error("invalid user");
        return
    }

    //the user that sends the request
    //var currentUser = request.user;
    //console.log(currentUser);
    //send from client 
    var currentUserInstallationId = request.params.installationId;
    var userSessionQuery = new Parse.Query(Parse.Session);  //session query can only return the session related to the user
    //all sessions of this user
    //userSessionQuery.equalTo('user', currentUser);
    //except the session for this installation -> to not log the request performing user out
    userSessionQuery.notEqualTo('installationId', currentUserInstallationId);

    userSessionQuery.find({
        success: function(results) {
            response.success(results.length);
        }, 
        error: function(err) {
            //TODO: Handle error
            response.error(err);
        }
    });
});

任何人都有同样的问题或知道如何解决这个问题?

0 个答案:

没有答案