jeudi 2 avril 2015

Can't use Authorization in Hapi js

I'm finishing a project which consist in two parts. The server side, using Hapijs and the client side, a local simple form with jQuery. The problem is that I need to POST the form to the server from a local file (file://app). I've set:


cors: { origin: ['*'] }


in the server side and it's working like a charm. The problem is when I tried to add the Autorization. For that I'm using hapi-auth-bearer-token and if I add the Autorization headers in the XMLHttpRequest I get a 401 (Unauthorized). The AJAX call is generating an OPTIONS request instead of a POST one.


Any ideas ? Or if you have any example it would be awesome! Thanks.


Extra Data:


I'm using this HapiJs Boilerplate


Aucun commentaire:

Enregistrer un commentaire