Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
90
rated 0 times [  93] [ 3]  / answers: 1 / hits: 14588  / 10 Years ago, thu, january 1, 2015, 12:00:00

I have developed a simple application using AngularJS hosted here. I am consuming an API I developed myself in Laravel hosted here. When I try to log into the application using Firefox, it works fine. My API accepts the pre-flight OPTIONS request and responds with a 200 OK. Finally the POST request generates a token and the user is logged in.



On the other hand, when Chrome sends the pre-flight OPTIONS request, it receives an 403 back and it gives me this error in the console:



XMLHttpRequest cannot load http://angulairapi.rohanchhabra.in/auth. Invalid HTTP status code 403


I have tried sending the OPTIONS request on /auth via Postman REST client also, and it gives back a 200 OK as expected. Why is Chrome behaving like this? What am I missing?


More From » angularjs

 Answers
7

The Access Control is a server responsibility, you need config this in Laravel.



Use this package: Laravel Cors this helps very much.


[#40307] Tuesday, December 30, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
stefanicarolinat

Total Points: 145
Total Questions: 91
Total Answers: 93

Location: Cambodia
Member since Thu, Oct 7, 2021
3 Years ago
;