[Rails] facebook-omniauth 登入問題 (Invalid credentials)
問題
最近facebook都無法登入,原本以為是我不小心動到什麼, 後來才發現我所有的project都不能登入了。 出現的錯誤訊息如下
Authentication failure! invalid_credentials: OAuth2::Error, : {"error":{"message":"This authorization code has been used.","type":"OAuthException","code":100}}
解法
爬文才知道原來facebook API在2.4之後的版本都需要補上json解析
# [path] devise.rb
config.omniauth :facebook,
APP_ID,
APP_SECRET,
token_params: { parse: :json } #補上此行
補上後馬上就可以登入了
參考
- http://stackoverflow.com/questions/16176208/rails-could-not-authenticate-you-from-facebook-because-invalid-credentials
留言