问题描述
我已经创建了一个signUp函数供我的应用调用,并使用Parse.com后端JS代码来注册用户.
I've created a signUp function for my app to call, and the Parse.com backend JS code to sign the user up.
果然,用户将出现在数据库中.哎呀,我什至收到验证邮件(比原本要难得多的东西.这是主解析后端的设置"部分下的设置,而不是通过编程方式进行的设置)设置).
Sure enough, the user will appear in the database. Heck, I even got the verification email to be sent (something that was much harder than it should be. It is a setting under the "settings" section of the main parse backend, not something that is programatically set).
现在,我正在尝试从新注册的用户那里获取sessionToken.注册和检查成功后返回用户"对象,我看不到"sessionToken".我也没有在用户数据库中看到sessionToken ...
Now I'm trying to get the sessionToken from the newly signed up user. Returning the "user" object on success of the signup and inspecting, I don't see a "sessionToken". I also don't see a sessionToken in the user database...
有人可以给我一些可以返回sessionToken的代码吗?
Can somebody give me some code that will return the sessionToken?
以下是相关代码:
user.signUp(null, {
success: function(user) {
response.success(user);
},
error: function(user, error) {
alert("Error: " + error.code + " " + error.message);
}
});
我在这里没有sessionToken.我从哪里得到的?
I don't get a sessionToken here. Where do I get it from?
推荐答案
我最终使用的代码如下所示:
The code i ended up using looked something like this:
endpoint : "https://api.parse.com/1/login",
parameters : getTheLoginParametersFrom(user),
success : function(response) {
tablesModule.saveSessionId(response.sessionToken);
}
}
登录"的结果是response.sessionToken.
Where the result from the "login" is the response.sessionToken.
这篇关于Parse.com:如何返回会话令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!