我有一個執行查詢的命令行應用程序。這是代碼。需要訪問令牌來請求此資源FQL問題
問題是它接收到形式爲「abc ... | xyz ...」的訪問令牌。有 沒有會話部分。但是,返回的令牌無法用於執行我的查詢至 爲我的頁面選擇洞察。幫幫我 !!
const string permissions = "manage_pages,read_insights,offline_access";
dynamic oauthClient = new FacebookOAuthClient() ;
oauthClient.AppId = username ;
oauthClient.AppSecret = password ;
dynamic parameters = new ExpandoObject() ;
parameters.scope = permissions ;
parameters.response_type = "token" ;
// parameters.grant_type = "client_credentials" ;
dynamic result = oauthClient.GetApplicationAccessToken(parameters);
string token = result.access_token ;
// token comes back as "abc...|xyz..."
var fb = new FacebookClient(token);
string query = " select metric, value " +
" from insights " +
" where object_id = MY_PAGE and " +
" metric in ('page_impressions' , 'page_stories') and " +
" end_time >= end_time_date('2012-02-21') and " +
" end_time <= end_time_date('2012-02-11') and " +
" period = period('day') " ;
dynamic result2 = fb.Query(query) ; // Exception generated on this line.
return result2 ;
任何想法?
BTW - 結束時間的東西剪切和粘貼錯誤。應該是2012-02-11和2012-02-21之間的結束時間。令牌問題是我現在的問題。 – 2012-02-22 00:23:45
使用Facebook C#SDK v5.0.3 – 2012-02-22 02:43:58