Graph APIのバージョンを1.0から2.xに上げた途端、なんか動かなくなって困ってる人へ。
もしかしたらFB.init()の「status」パラメータが原因かも?
Determines whether the current login status of the user is freshly retrieved on every page load. If this is disabled, that status will have to be manually retrieved using .getLoginStatus(). Defaults to true.
https://developers.facebook.com/docs/javascript/reference/FB.init/v1.0
v1.0ではデフォルトがtrueだったのに…
Determines whether the current login status of the user is freshly retrieved on every page load. If this is disabled, that status will have to be manually retrieved using .getLoginStatus(). Defaults to false.
https://developers.facebook.com/docs/javascript/reference/FB.init/v2.2
v2.xではこっそりfalseに変わっています。
FB.init({
appId: '123456789',
version: 'v2.2',
xfbml: true,
status: true
});
認証が必要なAPIを叩く際には、上記のようにstatusを明示的に指定してあげるか、FB.getLoginStatus()を使いましょう。