个推的官网文档参考https://docs.getui.com/getui/server/rest_v2/token/
本人在百度AI测试完全OK,但在个推接口方面出现问题:
1、
Invalid CORS request
请各位老师指点一下
实施代码如下:
var timestamp=(new Date()).getTime().toString();
var MasterSecret='Th************';
var AppKey='6vg****************';
var str= {
"sign": sha256( AppKey+timestamp+MasterSecret),
"timestamp":timestamp,
"appkey": AppKey
};
$.ajax({
header: {
"Content-Type": "application/json;charset=utf-8"
},
type: "post",
contentType: "application/json;charset=utf-8",
url: "https://restapi.getui.com:443/v2/L5rDaXUbN07wk3eCPT7Hz/auth",
async: true,
data: JSON.stringify(str),
dataType: "json",
timeout: 30000,
success: function (d) {
//返回值格式
// {
// "code": 0,
// "msg": "",
// "data": {
// "expire_time": "",
// "token": ""
// }
// }
console.log('token值为:' + d.data.token);
}
})