【发布时间】:2018-02-20 16:59:51
【问题描述】:
我正在尝试使用 omniauth 将我的客户定向到外部服务授权页面。我的客户端使用 ember.js,我的服务器是 rails 服务器。就目前情况而言,我可以在服务器端拨打电话几乎没有问题,但我的客户端不会重定向,导致我阅读时出错
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404.
做一些研究表明我需要使用我已经安装和配置的 CORS。现在我只需要知道在哪里以及如何将access-control-allow-origin 标头应用于我的代码。谁能帮我解决这个问题?
我的路线:
get 'auth/:provider/callback' => 'sessions#create'
我的会话控制器:
class SessionsController < ApplicationController
def create
@request.env
auth = request.env['omniauth.auth']
Account.recieve_donation(auth)
end
end
【问题讨论】:
标签: ruby-on-rails ember.js cors omniauth access-control