2016-03-15 73 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); 
    } 
});  
}