Javascript 登录后无法使用ACS REST API发送推送通知
我想在我的网站上创建一个html/javascript表单。我想用这个表单在Android和iOS设备上发送推送通知 登录http请求工作正常:Javascript 登录后无法使用ACS REST API发送推送通知,javascript,api,rest,titanium,appcelerator,Javascript,Api,Rest,Titanium,Appcelerator,我想在我的网站上创建一个html/javascript表单。我想用这个表单在Android和iOS设备上发送推送通知 登录http请求工作正常: httpRequest.open('POST','https://api.cloud.appcelerator.com/v1/users/login.json?key=xxxAPKEYxxx&login=xxxEMAILxxx&password=xxxPASSWORDxxx'); httpRequest.send();
httpRequest.open('POST','https://api.cloud.appcelerator.com/v1/users/login.json?key=xxxAPKEYxxx&login=xxxEMAILxxx&password=xxxPASSWORDxxx');
httpRequest.send();
httpRequest.onload = function(){
var data = JSON.parse(this.responseText);
var sessionID = data.meta.session_id;
sendPush();
}
响应:{“meta”:{“code”:200,“status”:“ok”,“method_name”:“loginUser”…因此登录成功。但是当我调用sendPush函数时,我得到一个响应错误:响应错误:
“状态”:“失败”,
“代码”:400,
“消息”:“未能对用户进行身份验证”
你好,亚伦·桑德斯,谢谢你的回复!你还知道ACS呼叫苹果通知服务使用哪种协议吗?
function sendPush(){
httpRequest.open('POST','https://api.cloud.appcelerator.com/v1/push_notification/notify.json?key=xxxAPPKEYxxx&channel=xxxCHANNELxxx&payload=test');
httpRequest.send();
httpRequest.onload = function()
{
console.log(this.responseText);
};
}
function sendPush(){
var BASEURL = 'https://api.cloud.appcelerator.com/v1/'
httpRequest.open('POST', BASEURL + 'push_notification/notify.json?key=APPKE');
httpRequest.send({
channel : "xxxCHANNELxxx",
payload : "test"
});
httpRequest.onload = function() {
console.log(this.responseText);
};
}