2010-07-20 54 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