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

  • Home
  • SEARCH
  • 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 120651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:50:42+00:00 2026-05-11T03:50:42+00:00

I’m experiencing the same problem in this previous stackoverflow.com post . Specifically, I seem

  • 0

I’m experiencing the same problem in this previous stackoverflow.com post.

Specifically, I seem to be able to get the ‘Auth’ token correctly, but attempts to use it in the header when I access later pages still just return me the login page’s HTML.

Following links related to this post, I’ve determined that you need to make a subsequent call to this URL.

A call to the URL will then give you an ACSID cookie which then needs to be passed in subsequent calls in order to maintain an authenticated state.

When requesting this cookie, I’ve read various posts saying you need to specify your original auth token by appending it to the query string such that:

?auth=this_is_my_token 

I’ve also read that you should set it in the http header as described in google’s documentation such that a http header name/value is:

Authorization: GoogleLogin auth=yourAuthToken 

I’ve tried both approaches and am not seeing any cookies returned. I’ve used Wireshark, LiveHttpHeaders for Firefox, and simple NSLog statements trying to see if anything like this is returned.

Below is the code snippet I’ve been using.

NSURL* url = [NSURL URLWithString:[NSString stringWithFormat:@'http://yourapp.appspot.com/_ah/login?auth=%@', [token objectForKey:@'Auth']]]; NSHTTPURLResponse* response; NSError* error; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; [request setValue:[NSString stringWithFormat:@'GoogleLogin auth=%@', [token objectForKey:@'Auth']] forHTTPHeaderField:@'Authorization']; NSData * data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];    //show me all header fields NSLog([[response allHeaderFields] description]);  //show me the response NSLog(@'%@', [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]); NSArray * all = [NSHTTPCookie cookiesWithResponseHeaderFields:[response allHeaderFields] forURL:[NSURL URLWithString:@'http://yourapp.appspot.com/_ah/login']];  //show me all cookies for (NSHTTPCookie *cookie in all)  {     NSLog(@'Name: %@ : Value: %@', cookie.name, cookie.value);  } 

I hope you can use ClientLogin for Google App Engine code.

  • 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. 2026-05-11T03:50:43+00:00Added an answer on May 11, 2026 at 3:50 am

    Adding sample code to this question because someone contacted me directly about my solution. Note that you must set the ‘service’ parameter equal to ‘ah’ on the initial token request.

    Initial Request of Token [done synchronously] NOTE: the ‘service’ parameter is set to ‘ah’ and the ‘source’ is just set to ‘myapp’, you should use your app name.

    //create request NSString* content = [NSString stringWithFormat:@'accountType=HOSTED_OR_GOOGLE&Email=%@&Passwd=%@&service=ah&source=myapp', [loginView username].text, [loginView password].text]; NSURL* authUrl = [NSURL URLWithString:@'https://www.google.com/accounts/ClientLogin']; NSMutableURLRequest* authRequest = [[NSMutableURLRequest alloc] initWithURL:authUrl]; [authRequest setHTTPMethod:@'POST']; [authRequest setValue:@'application/x-www-form-urlencoded' forHTTPHeaderField:@'Content-type']; [authRequest setHTTPBody:[content dataUsingEncoding:NSASCIIStringEncoding]];  NSHTTPURLResponse* authResponse; NSError* authError; NSData * authData = [NSURLConnection sendSynchronousRequest:authRequest returningResponse:&authResponse error:&authError];    NSString *authResponseBody = [[NSString alloc] initWithData:authData encoding:NSASCIIStringEncoding];  //loop through response body which is key=value pairs, seperated by \n. The code below is not optimal and certainly error prone.  NSArray *lines = [authResponseBody componentsSeparatedByString:@'\n']; NSMutableDictionary* token = [NSMutableDictionary dictionary]; for (NSString* s in lines) {     NSArray* kvpair = [s componentsSeparatedByString:@'='];     if ([kvpair count]>1)         [token setObject:[kvpair objectAtIndex:1] forKey:[kvpair objectAtIndex:0]]; }  //if google returned an error in the body [google returns Error=Bad Authentication in the body. which is weird, not sure if they use status codes] if ([token objectForKey:@'Error']) {     //handle error }; 

    The next step is to get your app running on google app engine to give you the ASCID cookie. I’m not sure why there is this extra step, it seems to be an issue on google’s end and probably why GAE is not currently in their listed obj-c google data api library. My tests show I have to request the cookie in order sync with GAE. Also, notice I don’t do anything with the cookie. It seems just by requesting it and getting cookied, future requests will automatically contain the cookie. I’m not sure if this is an iphone thing bc my app is an iphone app but I don’t fully understand what is happening with this cookie. NOTE: the use of ‘myapp.appspot.com’.

    NSURL* cookieUrl = [NSURL URLWithString:[NSString stringWithFormat:@'http://myapp.appspot.com/_ah/login?continue=http://myapp.appspot.com/&auth=%@', [token objectForKey:@'Auth']]];     NSLog([cookieUrl description]);     NSHTTPURLResponse* cookieResponse;     NSError* cookieError;     NSMutableURLRequest *cookieRequest = [[NSMutableURLRequest alloc] initWithURL:cookieUrl];      [cookieRequest setHTTPMethod:@'GET'];      NSData* cookieData = [NSURLConnection sendSynchronousRequest:cookieRequest returningResponse:&cookieResponse error:&cookieError];    

    Finally, I can post json to my gae app. NOTE: the snippet below is an async request. We can handle responses by implementing didReceiveResponse, didReceiveData, didFailWIthError.

    NSURL* url = [NSURL URLWithString:[NSString stringWithFormat:@'http://myapp.appspot.com/addRun?auth=%@', mytoken]];     NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];     [request setHTTPMethod:@'POST'];     [request setHTTPBody:@'my http body';      NSURLConnection *connectionResponse = [[NSURLConnection alloc] initWithRequest:request delegate:self];     if (!connectionResponse) {         NSLog(@'Failed to submit request');     } else {         NSLog(@'Request submitted');     } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 174k
  • Answers 174k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If your classes are genuinely exactly as given then it's… May 12, 2026 at 2:57 pm
  • Editorial Team
    Editorial Team added an answer No. There is no sleep. Sorry. See my answer here… May 12, 2026 at 2:57 pm
  • Editorial Team
    Editorial Team added an answer Binary maths I think. Choose a location that's a power… May 12, 2026 at 2:57 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
In order to apply a triggered animation to all ToolTip s in my app,
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.