我的Facebook應用程序最初是要求用戶的基本許可,現在我添加了一些功能,需要擴展認證,除了將代碼更改爲如下所示,添加應用程序,我需要改變應用程序的其他任何東西。Facebook應用程序現在要求擴展許可,而不是基本的,
因爲當我從我的個人資料中刪除應用程序,然後試圖重新添加它,它只要求基本信息,我該如何告訴Facebook現在應用程序需要擴展權限,因爲它給我這個警告:OAuthException: (#200)用戶尚未授權應用程序執行此操作。
我需要重置更改某些設置的應用程序祕密嗎?
> $facebook = new Facebook(array( 'appId' => 'xxxxxxxxxxxx',
> 'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',));
>
> // Get User ID
>
>
> $user = $facebook->getUser(); if ($user) { try {
> // Get the user profile data you have permission to view
> $user_profile = $facebook->api('/me');
> $uid = $facebook->getUser();
>
>
> $url = $facebook->getLoginUrl(array(
> 'canvas' => 1,
> 'fbconnect' => 0,
> 'scope' =>'publish_stream'));
>
>
> $attachment = array (
> 'access_token'=>$facebook->getAccessToken(), 'message' => 'I had a
> question: should I write a PHP facebook app that actually worked?',
> 'name' => 'I Asked Bert', 'caption' => 'Bert replied:', 'link' =>
> 'http://apps.facebook.com/askbert/', 'description' => 'NO',
> 'picture' => 'http://www.facebookanswers.co.uk/img/misc/question.jpg'
>); echo "Test 1";
>
> $result = $facebook->api('/me/feed/','post',$attachment);
>
> echo "Test 2";
> $_SESSION['userID'] = $uid;
>
>
> } catch (FacebookApiException $e) {
> $user = null; } } else { die('Somethign Strange just happened
> <script>top.location.href="'.$facebook->getLoginUrl().'";</script>');
> }
感謝您的建議,但例外的是仍然存在 – PUG
做出 – PUG
作出了更新的變化。最後如果有api異常(又稱沒有權限),你有第二個getLoginUrl。添加該調用所需的範圍。 – bkaid