2011-08-05 47 views
9

我是Facebook應用程序開發新手。我想創建爲我的應用測試用戶,但是當我嘗試使用API​​在Facebook上創建測試用戶

https://graph.facebook.com/APP_ID/accounts/test-users?installed=true& 
name=FULL_NAME&permissions=read_stream&method=post&access_token=APP_ACCESS_TOKEN 

它顯示了以下錯誤的:

{ 
    "error": { 
    "type": "OAuthException", 
    "message": "(#15) The method you are calling must be called 
       with an app secret signed session" 
    } 
} 

我已閱讀&隨後於

提到的步驟

https://developers.facebook.com/docs/authentication/

問題仍然存在。請指導我,我該怎麼辦?

謝謝。

+2

看看這個[教程](http://www.masteringapi.com/tutorials/introduction-to-facebook-test-users-accounts-with-php-sdk/40/)。另請注意,Facebook最近爲[this](http://developers.facebook.com/blog/post/527/)引入了一個GUI! – ifaour

回答

15

您需要獲取有效的訪問令牌 - 應用程序訪問令牌將執行此操作。爲了得到這一點:

https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials 

代YOUR_APP_ID & YOUR_APP_SECRET與各自的值。

這將返回一個有效的訪問令牌,可在替代APP_ACCESS_TOKEN:

https://graph.facebook.com/APP_ID/accounts/test-users?installed=true&name=FULL_NAME&permissions=read_stream&method=post&access_token=APP_ACCESS_TOKEN 
+0

woooh它的工作..!謝謝兄弟 –

+0

非常歡迎。 – jBit

+0

由於某種原因名稱沒有工作..刪除它,然後它的工作 – iVentis

0

您需要一個'appId' => 'XXXXXXXXXXXXXX' a 'secret' => 'XXXXXXXXXXXXXX'一。

從Facebook的文檔:

爲了驗證您的應用程序,你必須在https://graph.facebook.com/oauth/access_token通過授權碼和您的應用程序祕密圖形API令牌端點。該應用程序的祕密可從Developer App,不應與任何人共享或嵌入任何代碼,您將分發

雖然這個鏈接似乎在下降。

+0

嘿感謝您的快速回復。我知道我必須在API中使用我的APP_ID和Access令牌。我已經嘗試過它仍然是給出同樣的錯誤。我認爲還有一些其他問題,請幫助 –

0

您可以使用Facebook Test Java API框架,它封裝了一個Java API創建測試用戶的過程。測試用戶還可以訪問用戶詳細信息,牆壁等,以便您可以創建自動測試來驗證您的應用程序行爲。

相關問題