Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authorization through setRequestHeader

I found this code which makes it possible to authenticate using setRequestheader and Ajax.

this.xmlDoc.setRequestHeader('Authorization','Basic ' + Base64.encode("User:Password"));

Unfortunatily I have no knowledge of Ajax and Base64 does not seem to be class or method I can reference. Is there an alternative for this Basic encryption? Or a simular encode function I can call from Javascript?

Thank you !

like image 326
Anonymoose Avatar asked Nov 03 '22 19:11

Anonymoose


1 Answers

You need a function to Base64 encode the User:Password string. See this question which gives a couple of good options to do this in javascript.

like image 153
just.another.programmer Avatar answered Nov 11 '22 16:11

just.another.programmer