Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7435135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:00:48+00:00 2026-05-29T10:00:48+00:00

I have a simple mobile app in Titanium that I’m using to debug the

  • 0

I have a simple mobile app in Titanium that I’m using to debug the ability to log into our user system.

At the moment, I cannot seem to see the Set-Cookie response header as it’s always returned as null.

I’m currently using Titanium SDK 1.7.5 (1.8 is horribly broken).

My code is very simple, a text book example of using the HTTPClient:

var loginReq = Titanium.Network.createHTTPClient();
var url = 'https://auth.csu.edu.au/login/login.pl';
var targetURL = 'http://my.csu.edu.au'

loginButton.addEventListener('click',function(e)
{
    if (username.value != '' && password.value != '')
    {
        loginReq.open('POST', url);

        Ti.API.info('Sending HTTP Request.');

        var params = {
            username: username.value,
            password: password.value,
            url: targetURL
        }

        loginReq.send(params);
    }
    else {
        alert("Username/Password are required");
    }
});

loginReq.onload = function() {
    var cookie = loginReq.getResponseHeader('Set-Cookie');
    Ti.API.info('Response Status: ' + loginReq.status);
    Ti.API.info('Response Header - Cookie: ' + cookie);
    Ti.API.info('Response Header - Location: ' + loginReq.getLocation());

    if (Ti.Platform.osname !== 'android')
        Ti.API.info('Headers: ' + JSON.stringify(loginReq.getResponseHeaders()));

    var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'test.html');
    f.write(this.responseText);

    var webview = Ti.UI.createWebView();
    webview.url = f.nativePath;

    var newWindow = Ti.UI.createWindow();
    newWindow.add(webview);
    newWindow.open({modal:true});
};

The output is as follows:

[INFO] Sending HTTP Request.
[INFO] Response Status: 200
[INFO] Response Header - Cookie: null
[INFO] Response Header - Location: https://auth.csu.edu.au/login/login.pl?redirect=true&url=http%3a%2f%2fmy%2ecsu%2eedu%2eau
[INFO] Headers: {"Connection":"Keep-Alive","Transfer-Encoding":"Identity","Keep-Alive":"timeout=5, max=99","Content-Type":"text/html","Server":"Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.7d mod_apreq2-20051231/2.6.0 mod_perl/2.0.4 Perl/v5.8.4","Date":"Thu, 02 Feb 2012 01:45:29 GMT"}

I’m just going around and around in circles as I can’t seem to see what is exactly wrong here. What confuses me is that HTTPClient.getResponseHeaders() is not even documented (Titanium.Network.HTTPClient-object.html) – and doesn’t work for Android.

I know there must be something there because the webview displays the authenticated page fine (you can’t get there unless you’re authorised + cookie).

How can I get a full list of the headers to make sure I’m getting all the headers I’m supposed to?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:00:48+00:00Added an answer on May 29, 2026 at 10:00 am

    I’ve found the answer to my own question.

    What I have in my code to return all headers is correct. Using HTTPClient.getResponseHeaders() is the correct method for iOS and HTTPClient.getAllResponseHeaders() for Android (no idea why there’s two different ways – that could be a question for another day).

    The reason I’m not seeing the cookie header is because of a bug in Titanium 1.7.5 (and still exists in 1.8.1). It’s not forwarding on the cookie on a 302 redirect.

    Jiras on the issues:

    • https://jira.appcelerator.org/browse/TIMOB-4537
    • https://jira.appcelerator.org/browse/TIMOB-1322
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple web mobile app that is calculating values in given fields.
I'm using jQTouch to build a simple mobile app with an html/js/jquery form that
I have simple jQuery Mobile site created using asp.net mvc 2 and uses basic
I have to write a simple mobile application that is able to receive broadcast
I have a simple C# app that needs to support several languages. What is
I have a simple app developed with jQuery Mobile and implemented in PhoneGap. It
We have an existing web app built with jQuery Mobile. Our goal is to
I am working on a simple web app using jquery mobile. I am attempting
I have a Mobile App (iPhone and Android) which allows user to login to
I am developing a simple Mobile App that displays currency rates from an XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.