auth.sessionChange在Javascript SDK中启用OAuth 2后Facebook事件停止工作

Jae*_*Lee 2 javascript events facebook oauth-2.0 facebook-javascript-sdk

我依赖于使用:

FB.Event.subscribe('auth.sessionChange', function(response) {
// my update user token code goes here
});
Run Code Online (Sandbox Code Playgroud)

在我将javascript SDK升级到oauth2版本之前,一切都很好.谁知道为什么?其他事件似乎工作得很好,就像edge.create一样.

只是auth.sessionChange事件不再为我解雇了.

名称是否被替换使用auth.statusChange?因为那对我也不起作用.我也看到有auth.authResponseChange.

坦率地说,我不知道哪个是真正的,似乎文档还没有更新(?).然而,他们现在都没有为我工作.

小智 5

根据升级指南,auth.sessionChange被auth.authResponseChange取代

您仍然可以像以前一样订阅事件集合:auth.login,auth.logout和auth.statusChange仍然有效,但不推荐使用auth.sessionChange并将其替换为auth.authResponseChange.当然,auth.sessionChange将继续工作,直到至少10月1日的转换时间,并且auth.authResponseChange仅在启用OAuth2时才相关.启用OAuth 2.0后,授权响应(而非会话)将传递给已连接用户的所有回调.

https://developers.facebook.com/blog/post/525/