Bug 414219 - Empty Google username after successful login
Summary: Empty Google username after successful login
Status: RESOLVED FIXED
Alias: None
Product: KAccounts
Classification: Frameworks and Libraries
Component: KCM (show other bugs)
Version: 19.08.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Telepathy Bugs
URL:
Keywords:
: 389784 414010 415696 418571 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-11-17 02:59 UTC by Lance Haverkamp
Modified: 2020-03-15 17:29 UTC (History)
20 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.12.3


Attachments
blocked (36.62 KB, image/png)
2019-12-22 17:35 UTC, Rik Mills
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lance Haverkamp 2019-11-17 02:59:11 UTC
SUMMARY
Using Kio Gdrive Online Accounts. Trying to set things up for first use. It goes through the motions, lets me click new account, connects to Google, Google asks for my username & password, then asks for 2FA code. Everything looks like it's going to work, but I can never get access to Google. The link that should appear in Dolphin for a specific Google account is never created. The only link in that ever appears in gdrive:/ is "new account"

I've tried this with both a Gsuite account, and a non-Guite account; neither works.

Using KDE Neon: Version 5.17.2 
Also tried in Kubuntu 18.04 (LTS), exact same results

STEPS TO REPRODUCE
1. install kio-gdrive
2. In dolphin Network > Google Drive > New Account > Create > Google > Enter email > Enter Password > Enter 2FA > Allow > Done

OBSERVED RESULT
Newly authorized account does not appear in Dolphin under gdrive:/

EXPECTED RESULT
An icon in Dolphin under gdrive:/ to access your account

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Both KDE Neon & Kubuntu LTS
(available in About System)
KDE Plasma Version: 5.17.2
KDE Frameworks Version: 5.63.0
Qt Version: 5.13.1
Also tried in Kubuntu 18.04 (LTS), from a different computer, exact same results

ADDITIONAL INFORMATION

I have verified that the google settings for my account do allow third-party app access.
Comment 1 Bobby Wibowo 2019-11-23 16:27:22 UTC
It seems I can reproduce this in KDE neon 5.17, Plasma 5.17.3, Frameworks 5.64.0, Qt 5.13.2.
New Google accounts added from System Settings > Personalization > Online Accounts won't actually have their username appear either (Screenshot: https://i.fiery.me/bGl8.png).
The account did not use 2FA.
Comment 2 Elvis Angelaccio 2019-11-24 10:05:14 UTC
Can reproduce, something broke :/
Comment 3 Elvis Angelaccio 2019-11-24 12:06:54 UTC
Not a kio-gdrive bug. The problem is that kaccounts fails to add the Google account. Details of the issue at https://gitlab.com/accounts-sso/signon-ui/issues/2

Moving to kaccounts-provider for now. We need to figure out if the problem is on our side (kaccounts-provider) or is an upstream issue (signon-ui).
Comment 4 Lance Haverkamp 2019-11-25 16:25:49 UTC
I do receive an email from Google letting me know that "KDE KAccounts Provider was granted access to your Google Account"  so the login actually works, from Google's perspective.
Comment 5 Marco Parillo 2019-11-27 15:19:43 UTC
Is it relevant that when I enter an incorrect password, I immediately fail (Wrong password. Try again or click Forgot password to reset it.), but when I enter a correct password, I get an empty Web authentication for google window, and when I close that window, I get and Unable to finish -- System Settings Module window with: There was an error while trying to process the request: Access grant not present
Comment 6 Lance Haverkamp 2019-11-27 15:24:50 UTC
(In reply to Marco Parillo from comment #5)
> Is it relevant that when I enter an incorrect password, I immediately fail
> (Wrong password. Try again or click Forgot password to reset it.), but when
> I enter a correct password, I get an empty Web authentication for google
> window, and when I close that window, I get and Unable to finish -- System
> Settings Module window with: There was an error while trying to process the
> request: Access grant not present

I see the empty window a lot, I just keep hitting refresh/reload; I suspect that's unrelated.
Comment 7 Elvis Angelaccio 2019-12-01 11:29:22 UTC
Tried again today and I could add my account without any issue. Weird.
Comment 8 Lance Haverkamp 2019-12-02 20:13:30 UTC
That's truly bizarre, it's working for me now, too.  Something very weird was going-on there, as Google clearly thought is was working both before & now.
Comment 9 Marco Parillo 2019-12-03 15:45:37 UTC
Still not working for me. In addition to kio-gdrive and kaccounts-provider are there any other dependencies?
Comment 10 Lance Haverkamp 2019-12-03 21:25:11 UTC
(In reply to Marco Parillo from comment #9)
> Still not working for me. In addition to kio-gdrive and kaccounts-provider
> are there any other dependencies?

Marco is correct, it seems only my KDE Neon (Stable Version 5.17.3)is working properly.  My Kubuntu 18.04 LTS laptop is still failing.
Comment 11 Alex 2019-12-12 02:41:08 UTC
Manjaro KDE 18.1.4
kaccounts-providers not work.
Not loggin in google accaount.
Comment 12 PerfMonk 2019-12-22 01:05:47 UTC
Same for me.  It seems the kde gdrive application is not yet approved by google.
Can you do something for it.

see printscreen at :  http://imaginasys.fastmail.fm/gdrive_not_approved.png

messages are in french. It just says that google connection is disabled for that application because it has not been verified by google yet.
Comment 13 Rik Mills 2019-12-22 17:35:16 UTC
Created attachment 124655 [details]
blocked

Blocked by Google in Kubuntu 18.04 and 19.10. See message attached.
Comment 14 Marco Parillo 2019-12-22 17:38:22 UTC
Possibly related to: https://bugs.kde.org/show_bug.cgi?id=415089
Comment 15 Andrius 2019-12-31 21:17:18 UTC
*** Bug 415696 has been marked as a duplicate of this bug. ***
Comment 16 Elvis Angelaccio 2020-01-19 16:35:40 UTC
(In reply to Marco Parillo from comment #14)
> Possibly related to: https://bugs.kde.org/show_bug.cgi?id=415089

Nope, the two issues are unrelated.
Comment 17 Wolfgang Bauer 2020-01-26 12:54:57 UTC
Maybe the KCM should set some default name if the username cannot be retrieved for whatever reason?
That would at least serve as a workaround, and should not be difficult to implement I suppose.
Comment 18 Wolfgang Bauer 2020-01-26 13:00:51 UTC
PS: I'll post a workaround here as well, to be able to use kio-gdrive despite of this problem.

- Run "sqlite3 ~/.config/libaccounts-glib/accounts.db"
- Enter "select * from Accounts;" to get the id of the account
- Enter "update Accounts set name="username" where id=1;" to set a username and
it should work. (replace 1 with the actual id, the username is actually
irrelevant and can be anything, it's just used to display the account in the
settings and kio-gdrive)
Comment 19 Wolfgang Bauer 2020-01-26 13:04:43 UTC
(In reply to Wolfgang Bauer from comment #18)
> PS: I'll post a workaround here as well, to be able to use kio-gdrive
> despite of this problem.
> 
> - Run "sqlite3 ~/.config/libaccounts-glib/accounts.db"
> - Enter "select * from Accounts;" to get the id of the account
> - Enter "update Accounts set name="username" where id=1;" to set a username
> and
> it should work. (replace 1 with the actual id, the username is actually
> irrelevant and can be anything, it's just used to display the account in the
> settings and kio-gdrive)

I maybe should add that the id is the first number in the output of the select statement.
Comment 20 kitaev 2020-02-17 19:45:53 UTC
Thanks, Wolfgang, this workaround resolved this issue for me!
Comment 21 Wolfgang Bauer 2020-02-18 09:21:47 UTC
I looked a bit more into this now.
This is the code that sets the account name (in kaccounts-integration/src/jobs/createaccount.cpp, line :
 if (m_account->displayName().isEmpty()) {
     m_account->setDisplayName(info.userName());
 }

info.userName() is an empty string here, and that breaks things.

But, this is only used for display purposes, not for the actual authentification (that's why the workaround in comment#18 actually works). So we could just use any other string here to fix this bug.

Proof-of-Concept "patch":
sed -i 's/m_account->setDisplayName(info.userName());/m_account->setDisplayName(QString("Account%1").arg(info.id()));/' src/jobs/createaccount.cpp
That would set the account name to "Account123" or similar.
(or maybe use QString("%1%2").arg(info.caption().arg(info.id()), that would give something like "google123" ;-) )

Of course one could also only do that if info.userName() is actually empty as well (i.e. what I suggested in comment#17).
Comment 22 Wolfgang Bauer 2020-02-18 09:42:30 UTC
Small corrections:
(In reply to Wolfgang Bauer from comment #21)
> This is the code that sets the account name (in
> kaccounts-integration/src/jobs/createaccount.cpp, line :
I forgot the actual line number here, it's line #183

> (or maybe use QString("%1%2").arg(info.caption().arg(info.id())
A bracket is missing there, should be:
QString("%1%2").arg(info.caption()).arg(info.id())
;-)
Comment 23 Wolfgang Bauer 2020-02-18 11:45:02 UTC
I uploaded a patch to phabricator:
https://phabricator.kde.org/D27474
Comment 24 Nicolas Fella 2020-02-25 21:54:46 UTC
*** Bug 389784 has been marked as a duplicate of this bug. ***
Comment 25 Wolfgang Bauer 2020-03-02 20:59:35 UTC
Git commit 4600d32a1c063db62c371b422f26263d1e991b40 by Wolfgang Bauer.
Committed on 02/03/2020 at 20:55.
Pushed by wbauer into branch 'release/19.12'.

[CreateAccount job] Never set an empty name when creating an account

At least when creating a google account, signon-ui isn't able to extract
the username from the login page anymore since a couple of months (and
newer versions ported to QtWebEngine don't even extract it at all
anymore because it was considered to be too fragile, which apparently
proved to be true...).

This looks kind of broken, and actually made kio-gdrive useless as that
doesn't even list accounts with an empty name.

To fix it, set the name to some arbitrary string in the case that
info.userName() is empty.
FIXED-IN: 19.12.3
Differential Revision: https://phabricator.kde.org/D27474

M  +6    -1    src/jobs/createaccount.cpp

https://commits.kde.org/kaccounts-integration/4600d32a1c063db62c371b422f26263d1e991b40
Comment 26 Wolfgang Bauer 2020-03-05 20:36:27 UTC
*** Bug 414010 has been marked as a duplicate of this bug. ***
Comment 27 Elvis Angelaccio 2020-03-15 17:29:22 UTC
*** Bug 418571 has been marked as a duplicate of this bug. ***