2016-03-15 57 views
0

我想签署用户的解析server.I已初始化的解析对象applicationid和密钥,但我无法signup.I越来越unuthorize error.I我正在开发Chrome应用程序。我也允许在mainifest文件中的权限。注册使用解析api(401(未授权))

Parse.initialize("app_id", "key"); 
var username= "[email protected]"; 
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(未授权)

+0

Parse.com的云托管后端被宣布关闭。开放源代码[Parse-Server](https://github.com/ParsePlatform/parse-server)可用,您可以自己托管。 –

+0

雅,但我必须使用parse.com api。 –

+0

如果init确实OK(正确的参数通过,反应良好),那么注册你应该工作 –

回答

0

初始化您解析

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); 
    } 
});  
}