简体   繁体   中英

Facebook Login w/ Devise & Omniauth-Facebook has CORS Error?

I've been trying to implement basic facebook login into a rails app that already users devise via their tutorial on integrating omniauth-facebook: https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview

However, as far as I can tell after following along with the full setup, I'm stuck with the error in the js console:

XMLHttpRequest cannot load https://www.facebook.com/dialog/oauth?client_id=... 

No 'Access-Control-Allow-Origin' header is present on the requested resource.

Origin 'http://localhost:3000' is therefore not allowed access.

I've been stuck all day trying to resolve this, via what is my understanding to be a CORS issue.

However, I've had no success with rack-cors ( https://github.com/cyu/rack-cors ) and attempting to manually set the headers in the application controller hasn't yielded any results.

I'm unsure where to proceed from here, and somewhat baffled that I haven't come across a solution yet for what must be a pretty standard implementation.

Any help or ideas would be greatly appreciated!

Thanks :)

Try restarting your server. :P

If that doesn't work, install the rack-cors gem and follow the relevant config/application.rb modifications then restart your server.

https://github.com/cyu/rack-cors

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