我正在使用nodejs登录,因为此页http://cloud.appcelerator.com/docs/api/v1/users/login解释道。
var util= require('util');
var oauth = require('oauth');
var querystring = require('querystring');
var configuration = {
api_url: "https://api.cloud.appcelerator.com",
consumer_key: "KEY",
consumer_secret: "SECRET",
access_token: "",
access_secret: ""
}
var oauth_client = new oauth.OAuth(
"",
"",
configuration.consumer_key,
configuration.consumer_secret,
"1.0",
"https://api.cloud.appcelerator.com",
"HMAC-SHA1");
var post_data = {
"login":"USER",
"password":"PASS"
};
oauth_client.post(configuration.api_url+'/v1/users/login.json?key=iCvdsr03TuL4h4Ryf59xPSkSB3kdehRU',
configuration.access_token, configuration.access_secret,
post_data, "application/json",
function(error, data, response) {
}
);
接下来,我应该获取sessionid并将其传递给需要用户登录的新请求(post或push),例如:
问题是我收到了错误
“您需要先登录或注册才能继续”
,这很可能意味着我没有将sessionid作为cookie传递,如此处所述
如何保留cookie以便我可以将其用于下一个请求?