Reputation: 851
I am using Ember Simple Auth to build an app which runs on a main domain and talks to an API on a subdomain.
In my development environment, I had an issue with passing the bearer token to the API because the app ran on port 9000 and the api on 8080, I whitelisted the the 8080 API URL and added some extra headers to my .htaccess file:
Access-Control-Allow-Credentials:true Access-Control-Allow-Headers:Authorization, X-Requested-With, Content-Type, Origin, Accept Access-Control-Allow-Methods:GET, OPTIONS, POST, HEAD, DELETE, PUT Access-Control-Allow-Origin:*
Now before every request, simple auth makes an OPTIONS call then the API call. I don't have control over the API so is there any way of changing this?
If it isn't possible, should the OPTIONS method include a body?
Upvotes: 1
Views: 604
Reputation: 4062
These requests aren't caused by Ember.SimpleAuth actually bus that's how CORS works - see here: http://enable-cors.org. The server has to reply with the correct headers so that it allows cross origin requests.
Upvotes: 5