简体   繁体   中英

OAuth2::Error Google +

My code in omniauth.rb I'm using Rails with OAuth so users can sign in with Google +

I've registered my app on the dev site, got my credentials, and listed my origin and callback as: http://localhost:3000 and that with /auth/google/callback on the end respectively.

However, when I navigate to Google + to authenticate, I click 'allow' and I'm navigated back to my app, I receive this Rails error message:

OAuth2::Error redirect_uri_mismatch: { "error" : "redirect_uri_mismatch" }

I don't understand how to fix this. What do I do?

You can not set localhost directly as your callback. You can use 127.0.0.1:3000/auth/google/callback instead as your callback url and it should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM