【发布时间】:2012-04-19 19:55:02
【问题描述】:
我正在使用这个 gem https://github.com/unixcharles/google_calendar_api_v2 它基于https://github.com/oauth/oauth-ruby
在客户端类中创建如下连接:
def initialize(consumer_key, consumer_secret, token, token_secret)
consumer = OAuth::Consumer.new(consumer_key, consumer_secret, {
:site => "https://www.google.com",
:scheme => :header
})
@connection = OAuth::AccessToken.new(consumer,token, token_secret)
@calendars = Calendar.new(@connection)
end
对于 consumer_key,我是否将 Google API 控制台列出的内容列为“客户端 ID”? 对于 consumer_secret,我是否将 Google API 控制台列出的内容列为“客户端密码”? 我知道令牌是我在 OAuth 身份验证后得到的。 我假设我将 token_secret 设置为 "" ?
这就是我正在做的事情,我不断得到:
"GoogleCalendarApiV2::AuthenticationError (GoogleCalendarApiV2::AuthenticationError):"
当我打电话时:
client = GoogleCalendarApiV2::Client.new {'Client ID'}, {'Client secret'}, params[:access_token], ""
calendar = client.calendars.all
知道发生了什么吗?
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-3 oauth google-api