Can execute Parse.User.logIn function in Cloud Code

472 views
Skip to first unread message

pushparaj samant

unread,
Aug 8, 2016, 3:48:32 AM8/8/16
to NodeChef
Hi,
I have a cloud code hosted admin console application. It requires the admin to login using the provided credentials.
exports.signin = function onSignin(req, res) {
    //console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>> Logging In ...." + req.body.username + " " + req.body.password);
    console.log(req.body.username);
    Parse.User
        .logIn(req.body.username, req.body.password)
        .then(function(obj) {

            console.log("LOGIN OK " + Parse.User.current().id);

            var query = new Parse.Query(Parse.Role);
            query.equalTo("name", "Globetrekker Admin");
            query.equalTo("users", Parse.User.current());
            return query.first();

        }, function(error) {
            console.log("Error Logging In: " + error.message);
            //res.redirect("/error");

            res.render('login', {
                errorMessage: error.message
            });
        })
The function is hit correctly and the username is shown in the logs. But after that there is no response and after some time it gives a 404 response in the browser. The Parse.User.logIn function never returns and as I have mentioned before as a major bug in your offering, there is no error log or anything showing whats wrong. Its a sincere request to please rectify this.  
Anyways I have no idea why the logIn function is not working in the cloud code. Does open parse server not provide this feature. 

pushparaj samant

unread,
Aug 8, 2016, 3:58:33 AM8/8/16
to NodeChef
To add here, the login functionality works fine from the mobile app side. 

pushparaj samant

unread,
Aug 8, 2016, 5:40:52 AM8/8/16
to NodeChef
The actual issue was happening in the query that it was not returning any data after the login, so it was not coming back but there was nothing in error log so no way to figure out what is going wrong. 

Dmitriy Kazimirov

unread,
Aug 8, 2016, 7:23:20 AM8/8/16
to NodeChef
hi,
Are you REALLY sure you code is correct for Parse Server (and not Parse.com)? 
Reply all
Reply to author
Forward
0 new messages