Handling session and cookies for log in on android app using titanium
hi I am working on Android application development.I have developed small application.after logging my application capture authentication token.But I am not storing any user name name password or authentication token.after logging my application; when I make request for accessing data from remote server it again ask me for log in.I want to access my data for further processing. I used following code.

for sending logging request: It gives me Authentication token(app.js)

    var xhr = Titanium.Network.createHTTPClient();
    xhr.onerror = function()
    {
    Titanium.API.info('error');
    alert(JSON.parse(this.responseText).error);
    };
    xhr.open('POST','http://192.168.1.2:3000/users/sign_in.json');
    var params = {'user[login]':username.value,'user[password]':password.value};
    Ti.API.info('Params'+JSON.stringify(params));
    xhr.send(params);	  

for accessing data:(main.js)

    var xhr = Titanium.Network.createHTTPClient();
    xhr.onerror = function()
    {
    Titanium.API.info('error');
    alert(JSON.parse(this.responseText).error);
    };
    xhr.open('GET','http://192.168.1.2:3000/lists.json');
    var params = {'[id]':'32'}; 
    Ti.API.info('Params'+JSON.stringify(params));
    xhr.send(params);
    
But it shows error that log in first.Is there any way to handle this problem.
Handling session and cookies for log in on android app using titanium
===

hi I am working on Android application development.I have developed small application.after logging my application capture authentication token.But I am not storing any user name name password or authentication token.after logging my application; when I make request for accessing data from remote server it again ask me for log in.I want to access my data for further processing. I used following code.

for sending logging request: It gives me Authentication token(app.js)

    var xhr = Titanium.Network.createHTTPClient();
    xhr.onerror = function()
    {
    Titanium.API.info('error');
    alert(JSON.parse(this.responseText).error);
    };
    xhr.open('POST','http://192.168.1.2:3000/users/sign_in.json');
    var params = {'user[login]':username.value,'user[password]':password.value};
    Ti.API.info('Params'+JSON.stringify(params));
    xhr.send(params);	  

for accessing data:(main.js)

    var xhr = Titanium.Network.createHTTPClient();
    xhr.onerror = function()
    {
    Titanium.API.info('error');
    alert(JSON.parse(this.responseText).error);
    };
    xhr.open('GET','http://192.168.1.2:3000/lists.json');
    var params = {'[id]':'32'}; 
    Ti.API.info('Params'+JSON.stringify(params));
    xhr.send(params);
    
But it shows error that log in first.Is there any way to handle this problem.