Ruby on rails 400错误-Google API存储的会话令牌?轨道
从开发环境转到生产环境时遇到问题,我的访问令牌出现了问题?不是100%肯定。对这些东西有些陌生。我在想我需要重置代币还是什么?如果我进入accounts.google.com并从我的帐户中删除该应用程序并再次授权我的应用程序,一切都会正常工作 这似乎是基于错误的问题代码,但我不是肯定的Ruby on rails 400错误-Google API存储的会话令牌?轨道,ruby-on-rails,google-api,google-calendar-api,Ruby On Rails,Google Api,Google Calendar Api,从开发环境转到生产环境时遇到问题,我的访问令牌出现了问题?不是100%肯定。对这些东西有些陌生。我在想我需要重置代币还是什么?如果我进入accounts.google.com并从我的帐户中删除该应用程序并再次授权我的应用程序,一切都会正常工作 这似乎是基于错误的问题代码,但我不是肯定的 def self.refresh!(refresh_token) conn = Faraday.new('https://accounts.google.com') do |conn| con
def self.refresh!(refresh_token)
conn = Faraday.new('https://accounts.google.com') do |conn|
conn.request :url_encoded
conn.response :json
conn.response :raise_error
conn.response :logger unless Rails.env.production?
conn.adapter Faraday.default_adapter
end
response = conn.post('/o/oauth2/token', {
grant_type: 'refresh_token',
refresh_token: refresh_token,
client_id: Settings::KEYS['OAUTH_CLIENT_ID'],
client_secret: Settings::KEYS['OAUTH_CLIENT_SECRET']
})
body = response.body
body['access_token'] if body['access_token']
end
任何关于如何进行身份验证的指导或解释都会有所帮助。您是否尝试过为您的生产和开发创建一组单独的客户ID和客户机密?耶。他们已经分开了。