har*_*hit 17 ruby-on-rails omniauth ruby-on-rails-3.2 angularjs
我在AngularJS上使用omniauth-facebook并且CORS无法正常工作.
我的omniauth.rb是
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook,"xxxxx", "xxxxx",
:scope => 'email,user_birthday,read_stream', :display => 'popup'
end
如果我将它用作rails应用程序和请求,一切正常.但是当我尝试通过Angular JS调用'http:\ localhost:3000\users\auth\facebook"时
$http.get('/users/auth/facebook').success(function(data, status, headers, config) {
            console.log("back in success");
            }).
            error(function(data, status, headers, config) {
            });
    }
我在JS控制台中看到以下错误
XMLHttpRequest无法加载 https://www.facebook.com/dialog/oauth?client_id=xxxx&display=popup ... thday%2Cread_stream&state = 3352c1924bdbc9277f7b1070c38d67acf79b529f198323cb.请求的资源上不存在"Access-Control-Allow-Origin"标头.
'http://localhost:3000'因此不允许原点访问.
(该控制台中的网址未完全显示)
我添加了以下行
config.middleware.insert_before Warden::Manager, Rack::Cors
但这也行不通.
什么是最好的方式或如何覆盖OmniAuth的标头?
我正在使用Angularjs和gem devise,omniauth-facebook