Bug 388483

Summary: Setting up a GMail account hangs at "Checking token, This should take a moment"
Product: [Frameworks and Libraries] libkgapi Reporter: Metko <metkometko>
Component: GeneralAssignee: Daniel Vrátil <dvratil>
Status: RESOLVED FIXED    
Severity: normal CC: arojas, aspotashev, bjorn.bidar, camodoah, ck_ming91, cribari, damigos, david.kahles96, kaigue7, kde.kfoar, keikoz, loic, Magog_49, mathias_walther, r.biegel, rlk
Priority: NOR    
Version: GIT   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Metko 2018-01-03 09:03:25 UTC
I tried to setup a kmail IMAP account that links to my gmail account. No matter which options I choose during the configuration, it invariably hangs showring the message "Schlüssel wir überprüft. Das kann einen Moment dauern". In particular I tried:
- to disable PGP encryption and publishing the key
- generating a new key or using an existing one
- enabled "less secure apps" in my gmail account
- to configure the IMAP account manually, i.e. not using the service discovery
Any ideas what else to try?
Comment 1 Antonio Rojas 2018-01-03 14:25:14 UTC
Which version of Qt are you using?
Comment 2 Metko 2018-01-04 10:39:37 UTC
Qt5Core is at 5.10.0. Anything else that may help?
Comment 3 Antonio Rojas 2018-01-04 12:19:31 UTC
Possibly related to https://bugreports.qt.io/browse/QTBUG-65223
Comment 4 Francisco Cribari 2018-01-04 12:25:44 UTC
I am not sure it is related to this bug, but I am unable to add a Google calendar to korganizer version 17.12.0-1. I run Arch Linux. The process is stuck at a window where we read: "Authorizing token. This should take a moment..."
Comment 5 rlk 2018-01-04 13:51:08 UTC
Observed also with latest openSUSE 42.3 RPMs (from KDE repo).
Comment 6 camodoah 2018-01-05 10:08:27 UTC
Also hanging on the message "Authorizing token. This should take a moment..." on Arch Linux in both korganizer 5.7.0 and kmail 5.7.0 when adding a gmail account. Don't really know what information might help, so I'll add the Qt and plasmashell versions: Qt version is 5.10.0 and plasmashell 5.11.5.

If this is unrelated to the reported bug here sorry for bothering
Comment 7 Oleg 2018-01-06 14:46:04 UTC
Try to use next servers:
imap: imap.googlemail.com
smtp: smtp.googlemail.com

These changes solve problem with gmail for me.

But the same problem exists for calendar.
Comment 8 kero 2018-01-06 17:35:18 UTC
I have the same problem since several days (and several desktops/laptops), on Archlinux.

As Oleg suggested, I could solve (at least for the moment ?) the problème by using imap.googlemail.com instead of imap.gmail.com

And as a side note, all this google bullshit is making me think that I'm eventually going to drop my accounts...
Comment 9 Mathias Walther 2018-01-06 17:47:08 UTC
(In reply to camodoah from comment #6)
> Also hanging on the message "Authorizing token. This should take a
> moment..." on Arch Linux in both korganizer 5.7.0 and kmail 5.7.0 when
> adding a gmail account. Don't really know what information might help, so
> I'll add the Qt and plasmashell versions: Qt version is 5.10.0 and
> plasmashell 5.11.5.
> 
> If this is unrelated to the reported bug here sorry for bothering

I can confirm the bug with exactly the same configuration like camodoah on Arch with latest updates.
Comment 10 KaiMing 2018-01-07 04:46:15 UTC
Hi, I have similar issue on openSUSE Tumbleweed snapshot 20180103-0. 

- QT 5.10.0
- KOrganizer 5.7.0

(P/S: I'm new here. If anyone can point me on any of the house rules here would be great.)
Comment 11 camodoah 2018-01-08 10:00:20 UTC
Might this be related to https://bugreports.qt.io/browse/QTBUG-65223 ?
Comment 12 Andrew Gaydenko 2018-01-11 13:40:13 UTC
*** This bug has been confirmed by popular vote. ***
Comment 13 David Kahles 2018-01-12 14:31:16 UTC
The problem seems is, that Google changed a URL on their oauth server.
After adapting the URL, login works again. I'll upload a patch soon.
Comment 14 David Kahles 2018-01-12 15:05:54 UTC
(In reply to David Kahles from comment #13)
> The problem seems is, that Google changed a URL on their oauth server.
> After adapting the URL, login works again. I'll upload a patch soon.

Here it is: https://phabricator.kde.org/D9843
Comment 15 David Kahles 2018-01-13 12:30:56 UTC
Git commit 2980ace5fc69f900432f18481397c5498dcc4bb1 by David Kahles.
Committed on 13/01/2018 at 12:30.
Pushed by davidk into branch 'master'.

Fix token page URL

Summary:
It seems like Google changed the URL of the token page.
Maybe we should use QString::startsWith, to be futureproof?

Test Plan:
- Login in KOrganizer and KMail works again
- All tests pass (though i think there is no oauth2 test)

Reviewers: dvratil, mlaurent

Reviewed By: mlaurent

Differential Revision: https://phabricator.kde.org/D9843

M  +1    -1    src/core/ui/authwidget_p.h

https://commits.kde.org/libkgapi/2980ace5fc69f900432f18481397c5498dcc4bb1
Comment 16 Daniel Vrátil 2018-01-13 18:03:43 UTC
Git commit fa572d93cfa463f61432dd92239e747f9642fbae by Daniel Vrátil, on behalf of David Kahles.
Committed on 13/01/2018 at 18:02.
Pushed by dvratil into branch 'Applications/17.12'.

Fix token page URL

Summary:
It seems like Google changed the URL of the token page.
Maybe we should use QString::startsWith, to be futureproof?

Test Plan:
- Login in KOrganizer and KMail works again
- All tests pass (though i think there is no oauth2 test)

Reviewers: dvratil, mlaurent

Reviewed By: mlaurent

Differential Revision: https://phabricator.kde.org/D9843

M  +1    -1    src/core/ui/authwidget_p.h

https://commits.kde.org/libkgapi/fa572d93cfa463f61432dd92239e747f9642fbae
Comment 17 Björn Bidar (Thaodan) 2018-01-20 18:49:44 UTC
Does this really files it? when using akonadi-google-data is only works when I'm getting the old auth page.
See here for new vs. old:
https://support.google.com/accounts/answer/7338427?co=GENIE.Platform%3DDesktop&hl=en
Comment 18 rlk 2018-01-21 18:38:54 UTC
Latest OpenSUSE Qt packages (based on 5.10, likely with fixes backported) work.
Comment 19 Reinhard Biegel 2018-01-27 14:32:31 UTC
Provided patch doesn't fix the problem for me. Login still hangs at "Checking token...".

Akonadi shows the accessed URL on the console. When copy/pasting this URL into a webbrowser, the server returns 404.
(https://accounts.google.com/o/oauth2/approval/v2/approvalnativeapp?auto=false&response=code....)
Comment 20 David Kahles 2018-01-28 15:50:48 UTC
I'm not sure why it doesn't work for some of you, but the authorization code changed again a few hours ago. In the new code, we don't rely on any hardcoded URL (which was the reason for the original bug), but instead use a more recommended method to get the authorization token.

Maybe you want to try again the latest version in the git repo? It's up to you to use the "master" branch or the "Applications/17.12" branch.
Comment 21 Reinhard Biegel 2018-01-31 12:59:21 UTC
Latest version from git works for me. Thanks.
Comment 22 Antonio Rojas 2018-02-11 09:39:51 UTC
*** Bug 390252 has been marked as a duplicate of this bug. ***
Comment 23 David 2018-02-11 11:51:13 UTC
How is the patch applied?
Comment 24 David Kahles 2018-02-20 15:11:10 UTC
(In reply to David from comment #23)
> How is the patch applied?

The patch is included in libkgapi 17.12.2. Check whether your distribution made an update to the package. Otherwise, compile libkgapi 17.12.2 yourself.
Comment 25 David Kahles 2018-02-20 15:20:08 UTC
*** Bug 390763 has been marked as a duplicate of this bug. ***