--- a/Plugins/Purple Service/AIPurpleGTalkAccount.m Wed Apr 01 14:05:03 2015 +0200
+++ b/Plugins/Purple Service/AIPurpleGTalkAccount.m Wed Apr 01 15:15:17 2015 +0200
@@ -116,14 +116,18 @@
- NSString *refresh_token = [[AIKeychain defaultKeychain_error:NULL] findGenericPasswordForService:self.service.serviceID
- keychainItem:NULL error:NULL];
- if (refresh_token && refresh_token.length) {
- [self useRefreshToken:refresh_token];
+ if (!self.UID.length) { + [self requestAccessToken]; - [self requestAccessToken];
+ NSString *refresh_token = [[AIKeychain defaultKeychain_error:NULL] findGenericPasswordForService:self.service.serviceID + keychainItem:NULL error:NULL]; + if (refresh_token && refresh_token.length) { + [self useRefreshToken:refresh_token]; + [self requestAccessToken]; @@ -203,7 +207,23 @@
NSArray *components = [jsonWebToken componentsSeparatedByString:@"."];
if (components.count == 3) {
- NSData *identityData = [[NSData alloc] initWithBase64EncodedString:[[components objectAtIndex:1] stringByAppendingString:@"=="] options:NSDataBase64DecodingIgnoreUnknownCharacters];
+ NSString *base64EncodedIdentity = [components objectAtIndex:1]; + switch (base64EncodedIdentity.length % 4) { + base64EncodedIdentity = [base64EncodedIdentity stringByAppendingString:@"=="]; + base64EncodedIdentity = [base64EncodedIdentity stringByAppendingString:@"="]; + NSData *identityData = [[NSData alloc] initWithBase64EncodedString:base64EncodedIdentity options:NSDataBase64DecodingIgnoreUnknownCharacters]; NSDictionary *identity = [identityData objectFromJSONData];
AILogWithSignature(@"%@", identity);
@@ -215,6 +235,11 @@
+ if (!self.UID.length) { + [self setLastDisconnectionError:@"Obtaining your JID failed"]; if ([responseDict objectForKey:@"refresh_token"]) {
[[AIKeychain defaultKeychain_error:NULL] deleteGenericPasswordForService:self.service.serviceID
--- a/Plugins/Purple Service/AIPurpleGTalkAccountViewController.m Wed Apr 01 14:05:03 2015 +0200
+++ b/Plugins/Purple Service/AIPurpleGTalkAccountViewController.m Wed Apr 01 15:15:17 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%20email"
+ @"scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgoogletalk%20https://www.googleapis.com/auth/userinfo.email" @"&redirect_uri=urn:ietf:wg:oauth:2.0:oob"
@"&client_id=" ADIUM_GTALK_CLIENT_ID;
--- a/Plugins/Purple Service/libpurple_extensions/auth_gtalk.c Wed Apr 01 14:05:03 2015 +0200
+++ b/Plugins/Purple Service/libpurple_extensions/auth_gtalk.c Wed Apr 01 15:15:17 2015 +0200
@@ -42,10 +42,11 @@
xmlnode_set_attrib(auth, "mechanism", "X-OAUTH2");
xmlnode_set_attrib(auth, "auth:service", "oauth2");
xmlnode_set_attrib(auth, "xmlns:auth", "http://www.google.com/talk/protocol/auth");
+ xmlnode_set_attrib(auth, "auth:client-uses-full-bind-result", "true"); resp = g_string_append_c(resp, '\0');
- resp = g_string_append(resp, js->user->node);
+ resp = g_string_append(resp, jabber_id_get_bare_jid(js->user)); resp = g_string_append_c(resp, '\0');
resp = g_string_append(resp, purple_connection_get_password(js->gc));