I need to get back gvx cookies from Google Voice login post request in order to do direct access number calling. From my understanding, Google Voice will set a gvx cookies on the client identified as a mobile device (I have set the correct user-agent) once logged in.
I can successfully log in using this URL Post Request:
https://accounts.google.com/ServiceLogin?ltmpl=mobile&btmpl=mobile&Email=username%40gmail.com&Passwd=mypassword&service=grandcentral&continue=https%3A%2F%2Fwww.google.com%2Fvoice%2Fm&timeStmp=&secTok=&signIn=Sign+in
and USER-Agent:
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5
Objective-C code:
NSString *data = [NSString stringWithFormat:@"ltmpl=mobile&btmpl=mobile&Email=%@&Passwd=%@&service=grandcentral&continue=%@&timeStmp=&secTok=&signIn=Sign+in", self.user.urlEncoded, self.password.urlEncoded, [NSString stringWithFormat:@"https://www.google.com/voice/m"].urlEncoded ];
if (captchaResponse && captchaToken) {
data = [data stringByAppendingFormat: @"&logintoken=%@&logincaptcha=%@",
captchaToken.urlEncoded,
captchaResponse.urlEncoded];
}
NSData *requestData = [NSData dataWithBytes: [data UTF8String] length: [data length]];
NSURL *url = [NSURL URLWithString: LOGIN_URL_STRING];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: url];
[request setHTTPMethod: @"POST"];
[request setHTTPBody: requestData];
[request setValue: USER_AGENT_IPHONE forHTTPHeaderField: USER_AGENT_HEADER];
NSURLResponse *resp = nil;
NSError *err = nil;
NSData *response = [NSURLConnection sendSynchronousRequest: request returningResponse: &resp error: &err];
self.general = [dict objectForKey: RAW_DATA];
if (self.general) {
self.rnrSe = [self discoverRNRSE];
}
[self fetchSettings];
NSHTTPCookie *cookie;
NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [cookieJar cookies]) {
NSLog(@"%@", cookie);
}
All i got back from cookies are 3 names:
GALX - with some random characters and numbers value
GAPS - with some random characters and numbers value
S - with value: "grandcentral=xxxxxx..xxxx"
I should get back a lot more in Cookies such as:
HSID, SSID, APISID, PREF, NID
And most importantly gvx
cookie. That's what I'm looking for.
How do I get the gvx cookies?