简体   繁体   English

Facebook登录w / Devise&Omniauth-Facebook有CORS错误?

[英]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 我一直在努力实现基本的facebook登录到一个rails用户已经通过他们的集成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: 但是,据我跟随完整的设置,我可以告诉我,我在js控制台中遇到错误:

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. 我整天都试图解决这个问题,通过我的理解是一个CORS问题。

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. 但是,我在使用rack-corshttps://github.com/cyu/rack-cors )时没有成功,并且尝试在应用程序控制器中手动设置标头并没有产生任何结果。

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 :P

If that doesn't work, install the rack-cors gem and follow the relevant config/application.rb modifications then restart your server. 如果这不起作用,请安装rack-cors gem并按照相关的config / application.rb修改,然后重新启动服务器。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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