客户要求只用前端技术完成,不能使用PHP。
$.ajax({
url: "http://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=这是client_id&client_secret=这是client_secret&",
type: "post",
success: function (data) {
alert('success')
},
error: function (data) {
alert('error')
}
});
获取Access Token请求URL数据格式
向授权服务地址https://aip.baidubce.com/oaut...(推荐使用POST),并在URL中带上以下参数:
grant_type: 必须参数,固定为client_credentials;
client_id: 必须参数,应用的API Key;
client_secret: 必须参数,应用的Secret Key;
请求结果为error(readyState0),查过资料,众说纷纭,没有找到解决方案。
求助!