延伸后,我可以:
如何从响应中获取令牌。
我的代码:
<script>
window.onload = function() {
FB.init({appId:422642254433770, cookie:true, status:true, xfbml:true });
FB.getLoginStatus(function(response) {
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
var accessTokenOld = response.authResponse.accessToken;
//Extend access token
var OauthParams = {};
OauthParams['client_id'] = 'CLIEN ID';
OauthParams['client_secret'] = 'CLIENT SECRET';
OauthParams['grant_type'] = 'fb_exchange_token';
OauthParams['fb_exchange_token'] = accessToken;
OauthParams['response_type'] = 'token';
FB.api('/oauth/access_token', 'post', OauthParams, function(extendResponse) {
console.log("Extend token: " + extendResponse.accessToken);
});
});
};
</script>