【发布时间】:2019-12-29 05:32:28
【问题描述】:
我正在尝试使用 angularjs 向“https://connect.squareup.com/v2/locations”发出请求,其中调用失败,说 403 FORBIDDEN。
这里是代码示例:
var url = 'https://connect.squareup.com/v2/locations';
var config = {
headers: {
'Authorization': 'Bearer sandbox-sq0atb-JJGltCa375qzAyoQbjPgmg',
'Accept': 'application/json',
"X-Testing": "testing"
}
};
$http.get(url, config)
.then(
function (response) {
console.dir(response);
},
function (response) {
console.log("failed" + response)
}
);
我对上面的示例做了一个小提琴。任何帮助表示赞赏。
【问题讨论】:
-
您正在处理 CORS 问题,它必须通过服务器处理。
标签: angularjs http payment-gateway square-connect