0

我已经尝试了几个小时从 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'

编辑:我需要强制 content-type 吗?您有替代解决方案 RestClient 吗?

4

1 回答 1

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'
于 2013-08-25T15:26:52.333 回答