![](/img/trans.png)
[英]Can't retrieve access_token, refresh_token from Omniauth authentication strategy with Devise, Rails 4
[英]Can't refresh my access_token
我已經嘗試了好幾個小時,以從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的替代解決方案?
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'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.