本文介绍了Facebook帐户取消或取消授权Facebook应用程序,并查看从Facebook应用程序链接的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站应用程序具有通过Facebook登录的功能登录。我的应用程序在Facebook上存在。

My website application having feature login with Facebook login. And for which my app is present on Facebook. Login with facebook is working fine.

但应用程序具有将Facebook帐户链接到Facebook应用程序的功能。

But application have feature of linking and unlinking facebook account to Facebook app.


  • 如何检查FB帐号是否与特定的FB应用程序相关联?

  • 如何链接FB帐户与特定FB应用程序的关联(根据该用户的请求)?

(链接表示我们根据请求选择允许FB应用程序)

("Linked" means we select "Allow" to FB app on request)

推荐答案

请注意Facebook在弃用REST API的过程中,并为auth.revokeAuthorization方法的Graph API User对象添加了等效的支持。

Please note Facebook in the process of deprecating the REST API, and have adding equivalent support to the Graph API User object for "auth.revokeAuthorization" method.

//$this->facebook is facebook object
//$userid is of logged in user or can be written hardcoded.
For checking linked in or not by making api call.

        $user_id = $this->facebook->getUser();
        $result = $this->facebook->api(array(
                'method' => 'fql.query',
                'query' => "SELECT is_app_user FROM user WHERE uid=$user_id"
        ));
        $is_installed = $result[0]['is_app_user'];
        if($is_installed==1) {
            echo 'Linked';
        }
        else {
            echo 'Not Linked';
        }


For delinking or deauthorization the user by making app call:

        $user_id = $this->facebook->getUser();
        $access_token=$this->facebook->getAccessToken();
        $result = $this->facebook->api(array(
                'method' => 'auth.revokeAuthorization',
                'uid' =>$user_id,
                'access_token'=>$access_token
        ));

这篇关于Facebook帐户取消或取消授权Facebook应用程序,并查看从Facebook应用程序链接的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 13:05