Showing posts with label Security. Show all posts
Showing posts with label Security. Show all posts

Friday, February 11, 2011

Authenticating to Domino via Ajax in PhoneGap

How can my Native Android application login to Domino via Ajax?

I need to Authenticate to Domino to determine what access level, Roles, Author/Reader Fields are used.

function doDominoLogin(username, password) {
var logReq = createXHTMLHttpRequest() ;
var poststring = "RedirectTo=" + escape('yourdb.nsf/login.html') +
"&Username=" + username + "&password=" + password;
logReq.open("POST", "http://www.yoursite.com/names.nsf?Login" , false);
logReq.send(poststring);

alert(logReq.status);

alert(logReq.responseText);


if (logReq.status == 200){ return(true); } else { return(false);};
}

function createXHTMLHttpRequest() {
try { return new ActiveXObject("Msxml2.XMLHTTP") ; } catch (e) {}
try { return new ActiveXObject("Microsoft.XMLHTTP") ; } catch (e) {}
try { return new XMLHttpRequest() ; } catch (e) {}
alert("XMLHttpRequest is not supported on this browser!");
return null;
}