2013-05-14 73 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