我已将 Google Drive 与我的应用程序集成在一起,直到今天它都运行良好。我没有更改任何代码或客户端 ID,现在在我们网站上授权 GDrive 时出现此错误:
Google::APIClient::ClientError
无法在以下位置检索发现文档:https ://www.googleapis.com/discovery/v1/apis/oauth2/v2/rest
我正在使用 Ruby Google Api 客户端,这是引发错误的代码:
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'
)
错误出现在“result = gclient.execute!”。Google Ruby API 客户端库有什么变化吗?