-1

I want to validate an iOS user calling a Cloud Code function.

Parse.Cloud.define("sayMyName", function(request, response) {
  var user = request.user; 
  console.log(user);
  response.success("Your name is: " + user.get("name"));
)};

However this always brings up undefined. There doesn't seem to be any documentation about this, and it is Parse specific, so my hands are kind of tied.

Within Cloud Code, how do I determine which user is calling the function?

rici
  • 234,347
  • 28
  • 237
  • 341
Eric Johnson
  • 1,087
  • 1
  • 11
  • 16

1 Answers1

0

and make sure user has name as key.

virendrao
  • 1,763
  • 2
  • 22
  • 42
  • The problem was the `"name"` key. `request.user` is the right accessor. If you remove the first 4 lines I'll accept your answer – Eric Johnson Nov 27 '15 at 19:19
  • 1
    Unfortunately this severe edit means the answer now shows up as a Low Quality Post. I suggest you add some context explaining why this solves the problem. Help others to understand. – APC Nov 28 '15 at 15:38
  • @virendrao @APC is right. You should edit your answer to `The user in a Parse request object does not get initialized with a 'name' parameter.` – Eric Johnson Nov 29 '15 at 06:25