FDA / openfda

openFDA is an FDA project to provide open APIs, raw data downloads, documentation and examples, and a developer community for an important collection of FDA public datasets.
https://open.fda.gov
Creative Commons Zero v1.0 Universal
572 stars 132 forks source link

Basic authorization headers result in CORS error #131

Closed woodsjs closed 4 years ago

woodsjs commented 4 years ago

According to https://open.fda.gov/apis/authentication/, Basic auth is supported using https.

Sending a header with Authorization: Basic <key> results in a CORS policy error during preflight. Removing the header results in a successful response. Adding the api_key as a parameter to the request results in a successful response.

In looking at the server response, the server sends only the following Access-Control-Allow-Headers: X-Requested-With To successfully complete the CORS preflight, to use the Authentication header, I believe Authorization needs to be added to the Access-Control-Allow-Headers response.

dkrylovsb commented 4 years ago

Fixed.