Facebook Login and Iframe redirection

后端 未结 5 1227
情书的邮戳
情书的邮戳 2020-12-06 23:52

I am building an Facebook IFrame App. I am using the below javascript code to request user to login and allow permissions for the application, after which they are supposed

5条回答
  •  半阙折子戏
    2020-12-07 00:41

    You may use the new Facebook Graph API (http://developers.facebook.com/docs/api) to handle authentication. First, you must check if you have the access_token:

    $access_token = $_REQUEST['access_token'];
    
    if($access_token != NULL) { 
      ...
    }
    else {
      // the following javascript
    }
    

    And the javascript is:

    
    

    You must have a file oauth_redirect.php like this:

    
      
    

    Finally, you can return to your index page (the $appurl variable) and test if the user has permission testing access_token presence.

    Hope it helps!

提交回复
热议问题