I'm relatively new to angularjs and I'm currently working on implementing some new features to an existing Angular JS application. The current API calls are quite intricate so I decided to make a direct call. Below is the code snippet for my new call:
https://i.stack.imgur.com/CktpX.jpg
Existing calls to the api from the AngularJS code are successful and have specific headers as shown in the "Works" section at the top of the image below (highlighted in red text). However, my new call includes additional headers like Access-Control-Request-Headers and Access-Control-Request-Method as seen in the "Fails" section at the bottom of the image below.
https://i.stack.imgur.com/9fcK0.jpg
Upon checking the Console in Chrome, I encountered the following error message for my new request: XMLHttpRequest cannot load http://localhost/blablabla/v1/login.json. Request header field Authorization is not allowed by Access-Control-Allow-Headers.
I also noticed that the "Accept" header in the request is missing "application/json" and "text/plain". How can I include these in the "Accept" header and remove the "Access-Control-Request-Headers" and "Access-Control-Request-Method"?