I am building a mobile app that connects to my grails app that uses spring security core.
Im building the app in titanium studio.
How do i check it the user has an open session on the mobile app.
I log in using the with the following code:
var xhr = Ti.Network.createHTTPClient();
var url = "http://localhost:8080/FYP/j_spring_security_check";
var postData = "";
postData += 'j_username=' + usernameField.value;
postData += '&j_password=' + passwordField.value;
postData += '&_spring_security_remember_me=on';
Ti.API.debug(url);
xhr.open("POST", url);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xhr.onload = function() {
var response = JSON.parse(xhr.responseText);
win.close({animate:true});
slidingMenu.open({animate:true});
if( response.error ){
alert( response.error );
} else {
//logged in now do something
}
};
xhr.onerror = function(){
Ti.API.error( "Error Logging in" );
};
xhr.send(postData);
But how would i check if the user has already logged in?
Make a custom method in grails using
and do a
GETrequest 🙂