0

我是全新的Facebook API。我創建了一個Facebook應用程序,並通過一個java web應用程序發送請求,邀請我的朋友使用我的應用程序並將它們重定向到應用程序下載頁面(或者在此刻訪問任何網頁,例如www.google.com) 。發送應用程序通知給Facebook的朋友

我已經按照下列步驟操作:https://developers.facebook.com/docs/reference/dialogs/requests/

但我不知道這就是我要找的。請任何幫助將是偉大的!

我寫的代碼是:

<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html"> 
<h:head> 
    <title>Facelet Title</title> 
</h:head> 
<h:body> 
    <div id="fb-root"></div> 
    <script src="http://connect.facebook.net/en_US/all.js"></script> 
    <p> 
     <input type="button" 
       onclick="sendRequestToRecipients(); return false;" 
       value="Send Request to Users Directly" 
       /> 
     <input type="text" value="User ID" name="user_ids" /> 
    </p> 
    <p> 
     <input type="button" 
       onclick="sendRequestViaMultiFriendSelector(); return false;" 
       value="Send Request to Many Users with MFS" 
       /> 
    </p> 

    <script> 
     FB.init({ 
      appId: '151779115008427', 
      frictionlessRequests: true 
     }); 

     function sendRequestToRecipients() { 
      var user_ids = document.getElementsByName("user_ids")[0].value; 
      FB.ui({method: 'apprequests', 
       redirect_uri: 'http://www.google.com', 
       message: 'My Great Request', 
       to: user_ids 
      }, requestCallback); 
     } 

     function sendRequestViaMultiFriendSelector() { 
      FB.ui({method: 'apprequests', 
       message: 'My Great Request' 
      }, requestCallback); 
     } 

     function requestCallback(response) { 
      // Handle callback here 
     } 
    </script> 
</h:body> 

我得到了一個錯誤:

My error in FB request

+0

檢查您的應用程序設置頁面是否在您的_Website中使用Facebook_登錄名創建了'redirect_uri'。 –

+0

redirect_uri在您提到的字段中正確設置,並且錯誤仍然存​​在。任何提示要做到這一點? –

+0

檢查[this](http://stackoverflow.com/questions/4691782/facebook-api-error-191)這個問題大多數情況下總是與您訪問的應用程序的URL不同,而'redirect_uri'不同於或應用程序設置中未指定 –

回答

0

我必須設置爲從我的網址,讓我推出REDIRECT_URI的基本URL請求(在我的情況下,URL = localhost:8080/FB_Test),所以我必須在我的網站的redirect_uri中使用Facebook登錄來設置baseURL:localhost:808 0。

此鏈接通過@Anvesh Saxena幫助了我很多!鏈接:Facebook API error 191

相關問題