我想爲玲壽命交換短命的用戶訪問令牌,但得到的錯誤(在all.js):爲Exchange短暫的訪問令牌壽命長,不工作
的ReferenceError:無效的分配左側
... TZCOZCkuZBxZAzVUSokiOJbXZAHhESJvuA97qXTpVbVj3P7AZDZD &到期= 512326
response.error.message:未知錯誤
代碼:
window.fbAsyncInit = function() {
FB.init({
appId: 'xxx', // App ID
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse XFBML
oauth: true
});
FB.login(function (response) {
if (response) {
var accessToken = response.authResponse.accessToken;
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var accessToken = response.authResponse.accessToken;
var OauthParams = {};
OauthParams['client_id'] = 'xxx';
OauthParams['client_secret'] = 'xxx';
OauthParams['grant_type'] = 'fb_exchange_token';
OauthParams['fb_exchange_token'] = accessToken;
OauthParams['response_type'] = 'token';
console.log(accessToken);
FB.api('/oauth/access_token', 'post', OauthParams, function(response) {
if (!response || response.error) {
console.log(response.error.message);
}
else {
console.log(response.accesstoken);
}
});
}
});
};
}, { scope: 'manage_pages' });
};
}
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
任何人有想法?
謝謝, /M
GET請求沒有改變FB錯誤消息和Firebug錯誤。這個客戶端代碼僅用於測試目的,當然我以後不會透露APP祕密。 –
這意味着你不會在後來做這件事 - 所以你爲什麼要「測試」一些永遠不會被使用的東西? – CBroe