mercredi 6 mai 2015

jQuery setRequestHeader Authorization

I'm trying to authorise an AJAX query based on this code:

...
beforeSend: function(xhr) { xhr.setRequestHeader('Authorization', 'BEARER ' + access_token); },
...

All work fine so far! But there are multiple ajax requests and the request header / the access token is not send each time (Every second or third time).

The first Request-Header looks like this:

  • Accept application/json, text/javascript, /; q=0.01
  • Referer URL.com
  • X-Requested-With XMLHttpRequest
  • User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS...
  • Authorization BEARER 00000000000

all work fine! But the next request:

  • application/json, text/javascript, /; q=0.01
  • Accept-Language en-us
  • Accept-Encoding gzip, deflate
  • Referer URL.com
  • User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS...
  • X-Requested-With XMLHttpRequest

Does anybody know whats going on here?

Aucun commentaire:

Enregistrer un commentaire