Bug 316798 - Google Contacts resource not retrieving contacts
Summary: Google Contacts resource not retrieving contacts
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: Google Resource (show other bugs)
Version: GIT (master)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Daniel Vrátil
Depends on:
Reported: 2013-03-15 20:49 UTC by Blackpaw
Modified: 2013-03-25 10:19 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.11


Note You need to log in before you can comment on or make changes to this bug.
Description Blackpaw 2013-03-15 20:49:10 UTC
Having deauthorised and removed the old contacts resource I added a new one, authorised using 2-factor authentication. It seemed to process ok but the resource does not display at all in Kontact and no contacts are retrieved.

In akonadiconsole its state never changes and abort/restart/sync etc appears to do nothing. Offline/Online does work.

The calendar resource does work but in the process of testing the contacts the calender resource lost its google auth several times and had to be reauthorised. Occasionally when re-adding the contacts resource I the auth page appeared twice.

Reproducible: Always

Steps to Reproduce:
1. Enable 2-factor Auth in Google
2. Add the google contacts resource
3. Authorise it with google
Actual Results:  
Resource appears in AkonadiConsole, does not appear in Kontact address book. No contacts are retrieved.

Expected Results:  
Resource should appear in kaddressbok and contacts should be synced from google.

I have not tested with single factor auth

Base system is Kubuntu 13.04 with KDE 4.10.1

I have nepomuk-core, nepomuk-widgets, libkgapi, akonadi, kdepimlibs and kdepim-runtime built from master (in that order).
Comment 1 Daniel Vrátil 2013-03-20 11:50:38 UTC
Could you please enable "LibKGAPI" and "LibKGAPI (Raw Data)" in kdebugdialog, restart Akonadi from terminal and observe whether there's any related output from the akonadi_googlecontacts_resource?
Comment 2 Blackpaw 2013-03-21 11:51:26 UTC

I'm not seeing an obvious errors in the log but no contacts downloading either.

And to be clear - the resource does not appear in Kontact at all, just in akonadiconsole.
Comment 3 Daniel Vrátil 2013-03-21 13:56:47 UTC
Could you try right-clicking the resource in AkonadiConsole and selecting "Configure"->"Configure Natively" ? Should open a configuration dialog. Re-select your account and confirm.
Comment 4 Blackpaw 2013-03-21 20:18:07 UTC
Did that. no difference I'm afraid.

I also removed the account, deleted the resource (calendar as well), restarted akonadi, re-added and reauthorised.

The resources states never changed from Ready - I never see it showin "retrieving contacts" (or whatever it should be).

Note that the GUI, i.e kaddressbook is 4.10.1 from packages.

I can send you the terminal log from earlier via email if you like.
Comment 5 Blackpaw 2013-03-22 23:03:01 UTC
I setup a kde 4.10.1 VM and just installed libkgapi from master - it works, but looks like Version 1 - Just "My Contacts" and "Other Contacts" and no cute icon :(

What else needs to be updated from master to enable it?
Comment 6 Blackpaw 2013-03-22 23:36:23 UTC
Ok, I added a second Gmail account that *doesn't* have two factor auth enabled. This worked perfectly.
Comment 7 Blackpaw 2013-03-23 11:37:01 UTC
Saw this on the console about from akonadiconsole after executing a "Synchronise All" on the resource:

akonadi_googlecontacts_resource_26(8434)/libakonadi Akonadi::CollectionSync::Private::execute: void Akonadi::CollectionSync::Private::execute() localListDone:  true  deliveryDone:  true
Error during executing query "INSERT INTO CollectionTable (remoteId, remoteRevision, name, parentId, resourceId, cachePolicyInherit, isVirtual) VALUES (:0, :1, :2, :3, :4, :5, :6)" :  "Duplicate entry '598-Friends' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"
Error during insertion into table "CollectionTable" "Duplicate entry '598-Friends' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"
Comment 8 Blackpaw 2013-03-23 12:59:56 UTC
I believe I've found the src of the problem - I had two contacts groups, "Family" and "Friend" that I *created myself*. Once I renamed them (in gmail)  to "Friends-1" and "Family-1" I was able to sync.

Now in kaddressbook I have the folders 

- Family
- Family-1
- Friends
- Friends-1

Family & Friends are empty.

Also I *do not* have "Family" or "Friends" groups in Gmail Contacts.
Comment 9 Blackpaw 2013-03-23 13:03:55 UTC
However, on my Android phone I do have doubled up Family and Friends groups in contacts.
Comment 10 Blackpaw 2013-03-24 00:08:47 UTC
I think the problem is related to this:


For a number of people the default Family, Friends and Coworkers groups disappeared from the web Contacts interface, so they recreated them manually. However the Default groups still seem to download via the API, which is why I see them doubled up on my Android.

This seems to be a common problem, particularly with older gmail accounts.

As a result I don't think you can rely on the group names being unique for use as foreign id's.
Comment 11 Daniel Vrátil 2013-03-25 08:46:13 UTC
Git commit a565d78c48ee85d3a39f8fb574a8841f56c83d7e by Dan Vrátil.
Committed on 25/03/2013 at 09:45.
Pushed by dvratil into branch 'master'.

Use full name of system groups to avoid collision with user groups

When users create groups "Friends" or "Family" manually, the
collection name would conflict with the system group names,
so we use system group full name ("System Group: Friends" etc)
to avoid the conflict.

Thanks to Lindsay for tracking down the issue.

M  +1    -1    resources/google/contacts/contactsresource.cpp

Comment 12 Blackpaw 2013-03-25 10:05:17 UTC
I can confirm works for me now with the duplicate group names. Thanks Dan.