Hi,

I am using Titanium Appcelerator (http://www.appcelerator.com/) to
develop a mobile application that will incorporate google health using
ClientLogin.  I have successfully got the authorization token and
profileID, and I'm now trying to retrieve the profile information, the
error I get is:

[INFO] ghGetProfile response: Oops an error has occured.
Please include the following information in your error report:
AP52v_Rb9lL-
R4Mgw0G3CtcfstIJUfr3nW9syxNulGTLfb4rvFyZ6qvPXKSRdV1lHv7c7a0BPIcwiSEC
vK3rBOKkyz4BzCD74FBfvHW1dIldSyOw=================3ryJKKGGU6gSljPvfLIrQmUhQIe2P02
FF3TGZAXnHUrK0xJP56cViV===================================8BmdIuxGOAokyfuBQprMCU
USlGpaiZFdQm1g01TVDc==========================================lAY1emx2nv-
Qwb3lnC ...

Here's my Titanium (javascript) code:

function ghLogin(email, password){
        Titanium.API.debug('in ghLogin');

    var auth;
    var xhr =  Titanium.Network.createHTTPClient();
    var URL = "https://www.google.com/accounts/ClientLogin";;

    xhr.onload = function(){
        auth = this.responseText.match(/Auth=.*/);
        ghGetID(auth);
    };

    xhr.onerror = function(){
        Ti.API.info('error in ghLogin');
    };

    xhr.open("POST", URL);
    xhr.setRequestHeader("Content-type", "application/x-www-form-
urlencoded");
    xhr.send({"accountType":"HOSTED_OR_GOOGLE",
            "Email":email,
            "Passwd":password,
            "service":"health"});
}

function ghGetID(auth){
        Titanium.API.info('in ghGetID');

    var results;
    var profileID;
    var xhr =  Titanium.Network.createHTTPClient();
    var URL = "https://www.google.com/health/feeds/profile/list?
alt=json";

    xhr.onload = function(){
                try {
                        results = JSON.parse(this.responseText);

            profileID = results.feed.entry[0].content.$t;
            ghGetProfile(auth, profileID);
                }catch(e){
                        Ti.API.info("Problem parsing JSON response in ghGetID");
                }
    };
    xhr.onerror = function(){
        Ti.API.info('error in ghGetID');
    };

    xhr.open("GET", URL);
    xhr.setRequestHeader( "Authorization", "GoogleLogin " + auth);
        xhr.setRequestHeader( "GData-Version", "2");
    xhr.send();
}

function ghGetProfile(auth, profileID){
        Titanium.API.info('in ghGetProfile');

    var xhr =  Titanium.Network.createHTTPClient();
    var URL = "https://www.google.com/health/feeds/profile/
ui/"+profileID+"?alt=json";

    xhr.onload = function(){
        Ti.API.info('ghGetProfile response: ' + this.responseText);
    };

    xhr.onerror = function(){
        Ti.API.info('error in ghGetProfile');
    };

    xhr.open("GET", URL);
    xhr.setRequestHeader("Content-type", "application/atom+xml");
    xhr.setRequestHeader("Authorization", "GoogleLogin " + auth);
        xhr.setRequestHeader("GData-Version", "2");
    xhr.send();
}


I tried using h9, but that gave the same error message.  Can anyone
think of what is causing this error?

Thank you,
Ashtyn

-- 
You received this message because you are subscribed to the Google Groups 
"Google Health Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/googlehealthdevelopers?hl=en.

Reply via email to