2013-05-14 71 views
0

我一直在尝试几个小时才从Google API获取新的访问令牌,但它一直在抛出400错误:错误的请求。任何想法 ?无法刷新我的access_token

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解决方案?

回答

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' 
+0

呀,后琢磨出来的一天。谢谢 – Lex 2013-08-29 14:03:00