I'm trying to create new users with random passwords through cloudCode, but I always get an error. The error's body is the password I set.
Here's my code:
Parse.Cloud.define('account', function(request, response) {
Parse.Cloud.useMasterKey();
var randomString = Math.random().toString(36).slice(-8);
var user = new Parse.User();
user.setUsername(request.email);
user.setPassword(randomString);
user.signUp(null, {
success: function(newUser) {
response.success('Hooray');
},
error: function(error) {
response.error(error);
}
});
});
What I get as an error is: b.Error {code: 141, message: "{"password":"tnm3rf6r"}"}
Can anyone help ?
I've already tried placing useMasterKey()
outside of the function, inside, right before the signUp, etc.
Ok, I found my mistake.
You have to call request.params.parameterName
and not just request.parameterName
.
Silly Mistake.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.