我已经花了好几个小时从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的替代解决方案吗?
答案 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'