2015-04-17 45 views
0

有沒有辦法要求Facebook ads api沒有通過Web界面獲取訪問令牌(與oauth委託)?Facebook的廣告api流量服務器端

尋找at the documentation這都是關於重定向和oauth經典登錄步驟。

但是服務器可能需要收集數據而沒有人工貢獻;每兩週顯示一次Facebook登錄屏幕以獲取新的有效訪問令牌是不可行的。

該訪問令牌是否可以通過api調用生成?

// this call generates an app token, but end up with an exception 
// "You do not have sufficient permissions to perform this action" 
// on every api call relative to campaign, creative & co 

https://graph.facebook.com/oauth/access_token?client_id={id}&client_secret={secret} 

我錯過了什麼?

// Using the php ads sdk 

use FacebookAds\Api; 
Api::init($app_id, $app_secret, $access_token); 

// where app_id and app_secret can be found in the ad account preferences 
// and access_token has to be generated — but how? 
+0

取決於您需要什麼樣的訪問令牌。用戶訪問令牌的有效期可延長至60天,此後,您必須再次通過登錄流程,因爲這是生成用戶訪問令牌的唯一方式。 – CBroe

+0

用戶訪問令牌似乎是訪問廣告api端點的唯一方式。但是似乎用戶訪問令牌只能通過oauth委託的客戶端步驟生成 - 阻止了「僅服務器」解決方案 –

+0

是的,生成用戶訪問令牌需要客戶端交互。 – CBroe

回答