Skip to content

Instantly share code, notes, and snippets.

@sbisbee
Created February 10, 2012 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbisbee/1784646 to your computer and use it in GitHub Desktop.
Save sbisbee/1784646 to your computer and use it in GitHub Desktop.
sag.setDatabase('bwah');
sag.login({
user: 'user',
pass: 'pass'
); //using basic auth
sag.get({
url: '/someDoc',
callback: function(resp, worked) {
if(!worked) {
if(resp._HTTP.status == 403) {
alert('you are not logged in');
}
else {
alert('Some error!');
}
}
else {
//stuff
}
}
});
//////////////////////////
sag.setDatabase('bwah');
sag.login({
user: 'user',
pass: 'pass',
type: sag.AUTH_COOKIE,
callback: function(resp, succ) {
if(!succ) {
alert('invalid login');
}
else {
alert('time to do work!');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment