簡體   English   中英

在Rails上的Google+ OAuth = redirect_uri_mismatch

[英]Google+ OAuth on Rails = redirect_uri_mismatch

我使用Rails 4.2.5, omniauth-gplusomniauth-google-oauth2最新版本的gems,並遇到了相同的問題

omniauth.error"=>#<OAuth2::Error: redirect_uri_mismatch: 
{ "error" : "redirect_uri_mismatch" }>,  
"omniauth.error.type"=>:invalid_credentials,
"omniauth.error.strategy"=>#<OmniAuth::Strategies::GPlus>

OmniauthCallbacksController我進入:failure

OAuth可與其他提供程序配合使用)

我已經在device.rb添加了require "omniauth-google-oauth2" ,例如Google OAuth 2 redirect_uri_mismatch-OmniAuth Rails應用

實際上,我正在嘗試使用相同的設置。

我認為失敗在於我的console.developers.google.com設置。 現在,我不知道要嘗試使用授權JavaScript起源和授權重定向URI的其他組合。 (我在localhost,localhost別名(有和沒有端口)或heroku上嘗試了有無最后一個'/'的情況)

你能說我,對於http:// localhost:3000的 google + api來說什么設置完全正確?

還是我錯過了某些東西? 謝謝。

我建議你試試

http://127.0.0.1:3000

就個人而言,當我使用oauth重定向時,我喜歡使用Thin

$ gem install 'thin'

$ thin start --ssl

然后我將重定向uri設置為

https://127.0.0.1:3000

這樣,就不會出現協議不匹配的情況,並且可以讓您在請求之間保持會話狀態

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM