开发者

fired event when user allow the app

开发者 https://www.devze.com 2023-04-09 14:32 出处:网络
This event is fired when user login FB.Event.subscribe(\'auth.login\', function(response) { // 开发者_JAVA技巧});

This event is fired when user login

FB.Event.subscribe('auth.login', function(response) {
          //
开发者_JAVA技巧        });

But i am just looking for the event that is fired when user allows the app from auth dialog ?


FB.Event.subscribe('auth.authResponseChange', function(response) {
  alert('The status of the session is: ' + response.status);
});

auth.authResponseChange - fired when the authResponse changes, so in theory when a user allows the app from the auth dialog this will fire.

from http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/

Also, in the code to prompt the user to allow the app:

FB.getLoginStatus(function(response) {
  if (response.authResponse) {
    // logged in and connected user, someone you know
  } else {
    // no user session available, someone you dont know
   FB.login(function(response) {
   if (response.authResponse) {
      console.log(reponse);
      // here will be all the response details from confirmed app
   } else {
     console.log('User cancelled login or did not fully authorize.');
   }
 }, {scope: 'email'});
  }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消