Forum


01:32

16/01/2009

Hi All,
I just discovered JqGrid and have been working extensively with it for the last few days and have found these forums to be an invaluable source of information, so I thought I would give something back.
The following code can be used to HTTP Auth protect your JSON/XML/ i/o script.
First you must base64 encode the username:password like
var credentials = "<?php echo base64_encode("myusername:secretpassword");?> ";
In order to add the credentials into the request header you must implement the loadBeforeSendEvent in your jQGrid:
loadBeforeSend: function(xhr)
{
xhr.setRequestHeader("Authorization","Basic "+credentials);
return xhr;
}
And thats it! it will login with the provided credentials! I believe if you wish to use Digest auth you just replace Basic with Digest but I am not 100% on that....
Thanks jQGrid Team, keep up the good work and thanks for a great widget!
David
Most Users Ever Online: 715
Currently Online:
46 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66