It is not possible to log in on a server environment

454 views
Skip to first unread message

Duncan Graham

unread,
Jul 19, 2015, 6:56:23 PM7/19/15
to nod...@googlegroups.com
I'm getting the error, 'It is not possible to log in on a server environment' when I try to post to /login  (code below)

Why is this the case? What's the logic in making people do this client side? I can do Parse.User.signUp() on the server without any problems.



app.post('/login', function (req, res) {
var username = req.body.username;
var password = req.body.username;
console.log(username)
Parse.User.logIn( username, password, {
success: function(user) {
response.redirect('/')
},
error: function(user, error) {
console.log(error);
}
});
})

Erick Neverson

unread,
Jul 19, 2015, 7:10:00 PM7/19/15
to nod...@googlegroups.com
Your username and password are the same. 

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/fd87f5b7-52c2-4518-91e6-a71bbb7adf65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeremy May

unread,
Jul 24, 2015, 8:37:20 AM7/24/15
to nodejs, duncang...@gmail.com
Somewhere between v1.4.1 and v1.5.0 on the parse npm, they made it so this error message is thrown. I just ran into this and was surprised because I'm running another server that logs in and has elevated credentials. I've also used node CLI as a way to add people to roles. I suddenly couldn't log in from Node on a new project I'm working on. I noticed my old project had 1.4.1 of the parse npm and the new project was using 1.5.0. I modified my package.json to force the 1.4.1 and its working again.

Isen Ng

unread,
Jul 24, 2015, 1:53:47 PM7/24/15
to nodejs, duncang...@gmail.com, keni...@gmail.com
On the Parse JS changelog:

Removed the concept of the concept of the current user when running in node.js Current users can be enabled in node with Parse.User.enableUnsafeCurrentUser() Many requests now support passing an explicit session token as an option

Unfortunately none of their documentation has been updated to support this.
You'll have to dig into their source code to see how { sessionToken } is being used.
(Basically, in most calls to Parse, you can add sessionToken: <token> to the backbone options)

To allow server side login as before, just paste this line somewhere before the login
Parse.User.enableUnsafeCurrentUser();

Isen

Rahul Vinod Upputuri

unread,
Aug 8, 2015, 9:21:11 PM8/8/15
to nodejs, duncang...@gmail.com, keni...@gmail.com
Thanks Isen. This worked perfectly.
Reply all
Reply to author
Forward
0 new messages