1

我正在尝试在解析服务器上注册用户。我已将解析对象初始化为 applicationid 和密钥,但我无法注册。我收到未授权错误。我正在使用 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 https://api.parse.com/1/users 401(未经授权)

4

2 回答 2

1

初始化你的解析

 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);
    }
 });    
}
于 2016-03-16T06:12:07.833 回答
1

如果您使用的是解析服务器,那么您需要更改初始化

JavaScript

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

请参阅https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide#migrating

于 2016-06-10T21:14:52.260 回答