2012-08-16 145 views
3

我已將Google雲端硬盤與我的應用整合在一起,直到今天都運行良好。我沒有改變任何代碼或客戶端的ID,並在我們的網站授權GDrive的現在時收到此錯誤:Google API客戶端錯誤:Google :: APIClient :: ClientError

谷歌:: APIClient :: ClientError

無法檢索發現文檔:https://www.googleapis.com/discovery/v1/apis/oauth2/v2/rest

我使用Ruby谷歌API客戶端,這裏的地方拋出的錯誤代碼:「結果= gclient.execute」

require 'google/api_client' 

     gclient ||= (begin 
     client = Google::APIClient.new 
     client.authorization.client_id = Rails.application.config.gdrive_client_id 
     client.authorization.client_secret = Rails.application.config.gdrive_client_secret 
     client.authorization.redirect_uri = "#{request.protocol}#{Rails.application.config.host_url}/users/auth/gdrive" 
     client.authorization.access_token = auth_token.token 
     client.authorization.scope = [ 
     "https://www.googleapis.com/auth/drive", 
     "https://www.googleapis.com/auth/userinfo.email", 
     "https://www.googleapis.com/auth/userinfo.profile" 
     ] 
     client 
    end) 
    result = gclient.execute!(
     :api_method => 'oauth2.userinfo.get', 
     :version => 'v2' 
    ) 

錯誤的出現。 Google Ruby API客戶端庫中的內容有所改變嗎?

+0

看起來這是一個Google問題,當試圖用其他應用程序打開Goog​​le雲端硬盤映像時,我得到了完全相同的錯誤。 – ramz15 2012-08-16 20:31:35

回答

2

否 - Ruby庫中沒有任何更改。這是由於Google在https://www.googleapis.com/discovery/v1/apis提供的網絡服務發生了變化而引起的。

我知道這一點,因爲我今天從python API庫中遇到同樣的問題。

我找到了部分解決方法,這是爲了避免使用發現服務並直接點擊URL。對於用戶信息的OAuth2服務的URL是

https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=USER_TOKEN_HERE

這是不是一個偉大的長期解決方案,但希望將持有你在直到谷歌解決他們的發現服務。

更新 - 看起來就像是回到了現在(截至8月16日,2:07PST)

+0

導致問題的更改已回滾。現在按預期工作。 – 2012-08-16 21:17:21

+0

謝謝@SteveBazyl – ramz15 2012-08-16 21:21:05

0

曾經有

{ 「ID」: 「OAuth的:V2」, 「名稱「: 「OAuth的」, 「版本」: 「V2」 ... }

https://www.googleapis.com/discovery/v1/apis

現在不在那裏。 這就是問題所在。

這是問題的症狀。

相關問題