无法刷新我的access_token

时间:2013-05-14 10:09:48

标签: ruby-on-rails ruby

我已经花了好几个小时从Google API获取新的访问令牌,但它一直给我一个400错误:错误的请求。有什么想法吗?

r = RestClient.post 'https://accounts.google.com/o/oauth2/token', :refresh_token => refresh_token, :client_id => client_id, :client_secret => client_secret, :grant_type => 'access_token'

编辑:我是否需要强制内容类型?您有RestClient的替代解决方案吗?

1 个答案:

答案 0 :(得分:0)

grant_type应该是“ refresh_token ”而不是     “的的access_token

试试这个:

RestClient.post 'https://accounts.google.com/o/oauth2/token', :refresh_token => refresh_token, :client_id => client_id, :client_secret => client_secret, :grant_type => 'refresh_token'