Rails, нет "Access-Control-Allow-Origin"
У меня есть приложения на Angular, который использует сервер Ruby on Rails/oAuth. При регистрации пользователя в консоли я получаю эти ошибки.
POST*.herokuapp.com/api/users 500 (Internal Server Error) *.herokuapp.com/api/users:1
Failed to load *.herokuapp.com/api/users: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '*.herokuapp.com' is therefore not allowed access. The response had HTTP status code 500. /registration:1
{
"isTrusted": true /auth.ts:95
}
И другие ошибки, которые происходят
{"error":"invalid_grant","error_description":"The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
Error: Uncaught (in promise): {"error":"invalid_grant","error_description":"The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
Вот мое приложение.
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Dkeeper
class Application < Rails::Application
config.middleware.use Rack::Cors do
allow do
origins '*'
resource '*', headers: :any, methods: [:get, :post, :put, :patch, :delete, :options, :head]
end
end
end
end
Когда я вхожу, пользователь добавляется в базу данных, но я получаю сообщение об ошибке в консоли.
Спасибо за любую помощь.