Asking for permission using new PHP SDK (3.X.X)

后端 未结 2 1148
孤独总比滥情好
孤独总比滥情好 2021-01-31 12:20

How can I ask for permissions using new PHP SDK? I don\'t want to use the graph api and parse the url all the time. When the application is opened it should automatically ask fo

2条回答
  •  隐瞒了意图╮
    2021-01-31 12:56

    Session Based Login with scope and Logout with access_token for PHP-SDK 3.2.0.

     '135669679827333',
      'secret' => 'xxxxxxxxxxxxxxxxxxxxxx',
    ));
    $user = $facebook->getUser();
    if ($user) {
      try {
        // Proceed knowing you have a logged in user who's authenticated.
        $user_profile = $facebook->api('/me');
      } catch (FacebookApiException $e) {
        $user = null;
      }
    }
    if ($user) {
      $params = array(access_token => ''.$access_token.'');
      $logoutUrl = $facebook->getLogoutUrl($params);
    } else {
      $params = array(
         scope => 'read_stream,publish_stream,publish_actions,read_friendlists',
         //redirect_uri => $url
      );
      $loginUrl = $facebook->getLoginUrl($params);
    };
    $access_token = $_SESSION['fb_135669679827333_access_token'];
    ?>
    

    .

    
      Login & Connect
    
      Login & Connect
    
    

提交回复
热议问题