--- a/Plugins/Purple Service/AIPurpleGTalkAccount.m Wed Apr 01 12:37:07 2015 +0200
+++ b/Plugins/Purple Service/AIPurpleGTalkAccount.m Wed Apr 01 13:21:11 2015 +0200
@@ -120,7 +120,7 @@
keychainItem:NULL error:NULL];
+ if (refresh_token && refresh_token.length) { [self useRefreshToken:refresh_token];
[self requestAccessToken];
@@ -190,13 +190,33 @@
- (void)connectionDidFinishLoading:(NSURLConnection *)inConnection {
- NSDictionary *responseDict = [response objectFromJSONDataWithParseOptions:JKParseOptionNone error:&error];
+ NSDictionary *responseDict = [response objectFromJSONData]; AILogWithSignature(@"%@", responseDict);
[[adium accountController] setPassword:[responseDict objectForKey:@"access_token"] forAccount:self];
+ if (!self.UID.length) { + NSString *jsonWebToken = [responseDict objectForKey:@"id_token"]; + AILogWithSignature(@"id_token missing, can't set JID!"); + NSArray *components = [jsonWebToken componentsSeparatedByString:@"."]; + if (components.count == 3) { + NSData *identityData = [[NSData alloc] initWithBase64EncodedString:[[components objectAtIndex:1] stringByAppendingString:@"=="] options:NSDataBase64DecodingIgnoreUnknownCharacters]; + NSDictionary *identity = [identityData objectFromJSONData]; + AILogWithSignature(@"%@", identity); + [self filterAndSetUID:[identity objectForKey:@"email"]]; + [identityData release]; if ([responseDict objectForKey:@"refresh_token"]) {
[[AIKeychain defaultKeychain_error:NULL] deleteGenericPasswordForService:self.service.serviceID
--- a/Plugins/Purple Service/AIPurpleGTalkAccountViewController.m Wed Apr 01 12:37:07 2015 +0200
+++ b/Plugins/Purple Service/AIPurpleGTalkAccountViewController.m Wed Apr 01 13:21:11 2015 +0200
@@ -57,7 +57,7 @@
- (IBAction)requestAccess:(id)sender {
NSString *urlString = @"https://accounts.google.com/o/oauth2/auth?"
- @"scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgoogletalk"
+ @"scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgoogletalk%20email" @"&redirect_uri=urn:ietf:wg:oauth:2.0:oob"
@"&client_id=" ADIUM_GTALK_CLIENT_ID;