我使用ajax调用facebook graph api,如下所示,
$.ajax({
url: "https://graph.facebook.com/oauth/access_token?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=fb_exchange_token&fb_exchange_token="+accessToken,
type: 'GET',
contentType: "application/json",
success: function (response) {
},
error: function (error) {
console.log('Error occurd while retrieving long live access token');
}
});
但它显示错误如下,
Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response.
如果我使用postman
或使用浏览器发出请求,则可以正常使用。提供任何帮助以解决此问题。我尝试了几个关于服务器端Access-Control-Allow-Headers
的答案,但在这种情况下我没有对facebook方面的控制。