The Blog

JQuery and JWT Ajax Authentication Posted on


//JQuery falovered , adds the Authorization headers to each Ajax request - I store them in local storage
$.ajaxPrefilter(function( options ) {
if (options.beforeSend) {
options.beforeSend = function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer '+localStorage.getItem('token'));
}
}
});

This entry was posted in Uncategorized. Bookmark the permalink.

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *



CAPTCHA
Change the CAPTCHA codeSpeak the CAPTCHA code