Javascript 使用解析api注册(401(未经授权))

Javascript 使用解析api注册(401(未经授权)),javascript,parse-platform,google-chrome-app,parse-server,Javascript,Parse Platform,Google Chrome App,Parse Server,我正在尝试在解析服务器上注册用户。我已将解析对象初始化为applicationid和key,但无法注册。我收到未授权错误。我正在使用chrome应用程序。我还允许在mainifest文件中使用权限 Parse.initialize("app_id", "key"); var username= "jitendra.singh@gmail.com"; var password = "singh"; Parse.User.signUp(username, password, {}, {

我正在尝试在解析服务器上注册用户。我已将解析对象初始化为applicationid和key,但无法注册。我收到未授权错误。我正在使用chrome应用程序。我还允许在mainifest文件中使用权限

  Parse.initialize("app_id", "key");
var username= "jitendra.singh@gmail.com";
var password = "singh";

Parse.User.signUp(username, password, {}, {
    success: function (user) {
        console.log("Yay!");
    },
    error: function (user, error) {
         console.log("Error: " + error.code + " " + error.message);
    }
});
错误: POST 401(未经授权)

初始化您的解析

 Parse.initialize("app_id", "key");
调用这个函数

 function Signup(userInfo){
  var user = new Parse.User();
  // set the properties of the user
  user.set("username", "username");
  user.set("password", "password");
  user.set("email", "emailid");
  // Create a custom field for the user (there is no limit to the number of custom records)
  user.set("score", 0);
 user.signUp(null, {
   success: function(user) {
         // return the success response
         console.log("Success!");
   },
   error: function(user, error) {
          // return the error response
          console.log("Error: " + error.code + " " + error.message);
    }
 });    
}

如果您正在使用解析服务器,则需要更改初始化

JavaScript

Parse.initialize("YOUR_APP_ID");
Parse.serverURL = 'http://localhost:1337/parse'

请参见

Parse.com的云托管后端已宣布关闭。开放源代码是可用的,您可以托管yourself.ya,但我必须使用parse.comapi。如果init实际上正常(传递了正确的参数,响应良好),那么您的注册应该可以工作