jeudi 6 août 2015

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

I am trying to integrate omniauth google oath and while i can log in or create new user through google plus, i get this message when i click login but then disappears at the end of the request.

XMLHttpRequest cannot load http://ift.tt/1MQFN9M.


No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost:3000' is therefore not allowed access.

Also while on localhost i can create or login using google plus despite the error it doesn't work on heroku.

I've searched a lot but even though i added code like below in my application.rb file

headers['Access-Control-Allow-Origin'] = 'http://localhost:3000'

i still can't seem to get it right

Aucun commentaire:

Enregistrer un commentaire