2011-01-14 81 views
0

我需要我的應用程序請求offline_access權限(詳細here),但我一直對Facebook文檔感到困惑。Facebook應用程序:我在哪裏放置offline_access請求?

它說我需要我的權限要求一個逗號分隔的列表,像'publish_stream,offline_access'

我應該把下面的接口這個名單????

alt text

+0

你能告訴我們您的前端代碼(如果你問用戶登錄)?兩個答案都是正確的,但根據您的代碼,您可能想要使用不同的方法 – ifaour 2011-01-14 12:52:20

回答

2

它與API使用,如下

$facebook = new Facebook(array(
    'appId' => FACEBOOK_APP_ID, 
    'secret' => FACEBOOK_SECRET, 
    'cookie' => false, 
)); 

$facebook_login_url = $facebook->getLoginUrl(array(
    'next' => '', 
    'cancel_url' => '', 
    'req_perms' => 'email,publish_stream,status_update' 
)); 

哪裏$facebook_login_url是URL THA用戶需要遵循授予您訪問。

這有幫助嗎?

0

不能與該接口做到這一點。將用戶重定向到Facebook時,您需要設置scope參數。

x=y&scope=email,user_about_me,user_birthday,user_photos,publish_stream,offline_access 
0

首先定義您需要哪些權限:

$par['req_perms'] = "friends_about_me,friends_education_history,friends_likes,friends_interests,friends_location,friends_religion_politics, 
    friends_work_history,publish_stream,friends_activities,friends_events, 
    friends_hometown,friends_location,user_interests,user_likes,user_events, 
    user_about_me,user_status,user_work_history,read_requests,read_stream,offline_access,user_religion_politics,email,user_groups"; 
$loginUrl = $facebook->getLoginUrl($par); 

然後,檢查用戶是否已經訂閱應用程序:

$session = $facebook->getSession(); 
if (is_null($session)) { 
    // no he is not 
    //send him to permissions page 
    header("Location: $loginUrl"); 
} 
else { 
    //yes, he is already subscribed, or subscribed just now 
    echo "<p>everything is ok"; 
    // write your code here 
    } 
相關問題