2010-07-20 56 views
0

我想使用谷歌嗡嗡聲API發佈一些內容到我的谷歌Buzz帳戶。 我試圖使用他們已經提供了其示例代碼,但它給下面的錯誤谷歌嗡嗡聲API錯誤

Array 

( [HTTP_CODE] => 401 [標題] =>數組 ( [WWW驗證] => AuthSub realm =「https://www.google.com/accounts/AuthSubRequest」allowed-scopes =「https://www.googleapis.com/auth/buzz」 [Content-Type] => application/json; charset = UTF-8 [Date] => Tue,20 Jul 2010 12:22:05 GMT [Expires] => Tue,20 Jul 2010 12:22:05 GMT [Cache-Control] => private,max-年齡= 0 [X-Cont ent-Type-Options] => nosniff [X-Frame-Options] => SAMEORIGIN [X-XSS-Protection] => 1;模式=塊 [服務器] => GSE [傳輸編碼] =>分塊 )

[data] => Array 
    (
     [error] => Array 
      (
       [errors] => Array 
        (
         [0] => Array 
          (
           [message] => User must have authorized this application to have the following scope in order to make this call: [https://www.googleapis.com/auth/buzz] Also , make sure your application is using the Buzz specific OAuth authorization URL. 
           [locationType] => header 
           [location] => Authorization 
          ) 

        ) 

       [code] => 401 
       [message] => User must have authorized this application to have the following scope in order to make this call: [https://www.googleapis.com/auth/buzz] Also , make sure your application is using the Buzz specific OAuth authorization URL. 
      ) 

    ) 

我已經添加在其中被要求config.php文件中的變量

'site_name' => 'example.com', 

'oauth_consumer_key'=> 'example.com', 'oauth_consumer_secret'=> 'consumersecret', 'oauth_rsa_key'=> '',

有人知道我可能會在這裏做錯嗎?

如何存儲返回到數據庫的令牌?由於如果服務器重新啓動,緩存將丟失,用戶必須重新進行身份驗證。

回答

1

問題在於我傳遞的域名。我沒有通過example.com,而是通過http://example.com。因此,請確保site_name,oauth_consumer_key和域變量正確傳遞。

+1

'site_name'和'oauth_consumer_key'應該總是相同的值。 – 2010-08-20 22:58:04