简体   繁体   English

无法刷新我的access_token

[英]Can't refresh my access_token

I've been trying for hours to get a new access token from the Google API but it kept throwing me a 400 error : bad request. 我已经尝试了好几个小时,以从Google API获取新的访问令牌,但是它不断抛出400错误:错误的请求。 Any idea ? 任何想法 ?

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'

EDIT : Do I need to force content-type ? 编辑:我需要强制内容类型吗? Do you have an alternative solution to RestClient ? 您是否有RestClient的替代解决方案?

grant_type should be " refresh_token " and not " access_token " grant_type应该是“ refresh_token ”,而不是“ access_token

Try this: 尝试这个:

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'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用Devise,Rails 4从Omniauth身份验证策略中检索access_token,refresh_token - Can't retrieve access_token, refresh_token from Omniauth authentication strategy with Devise, Rails 4 无法使用Rails和OAuth gem获得我的access_token - Can't get my access_token using Rails and the OAuth gem 我可以使用多个(access_token,refresh_token)来通过Gatekeeper在不同的客户端/设备上为同一用户提供服务吗? - Can I have multiple (access_token, refresh_token) to serve the same user on different client/devices with doorkeeper? 保存 access_token - Save access_token 使用带有 rails 的 Azure AD 获取 access_token 和 refresh_token - Get the access_token and refresh_token using Azure AD with rails 在用户模型上存储access_token和refresh_token并再次使用它们会导致错误 - Storing an access_token and refresh_token on the user model and using them again causes error Rails:如何检查access_token是否已过期? - Rails: How can I check if the access_token is expired? Rails API访问令牌 - Rails API access_token 将access_token存储在AsyncStorage中 - Store access_token in the AsyncStorage 从access_token中查找用户 - Find a user from an access_token
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM