Bug#1033462: kmail: Kmail fails to send emails via Google mail with "Failed to authenticate additional scopes"

2024-04-20 Thread Sedat Dilek
OAuth 2.0 Scopes for Google APIs:

https://developers.google.com/identity/protocols/oauth2/scopes



Bug#1033462: kmail: Kmail fails to send emails via Google mail with "Failed to authenticate additional scopes"

2024-04-20 Thread Sedat Dilek
Hi,

I upgraded yesterday my machine from bookworm/stable to trixie/testing.

KMail was used to check if I can send emails - this seems no more to work.

Seeing the same issue like Ariel Garcia in #1033462 (sorry partly in German):

We have an error during reading password  "Entry not found"
We have an error during reading password  "Entry not found"
[SASL-XOAUTH2] - Requesting authID!
[SASL-XOAUTH2] - Requesting token!
[SASL-XOAUTH2] - filling prompts!
[SASL-XOAUTH2] - Requesting authID!
[SASL-XOAUTH2] - Requesting token!
org.kde.kgapi: Bad request, Google replied ' "{\n  \"error\":
\"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}" '
org.kde.pim.mailtransport.smtpplugin: Error obtaining XOAUTH2 token:
"Authentifizierung zusätzlicher Bereiche ist fehlgeschlagen"
org.kde.pim.ksmtp: SMTP Socket error:
QAbstractSocket::RemoteHostClosedError "Der entfernte Rechner hat die
Verbindung geschlossen"

English:

org.kde.pim.mailtransport.smtpplugin: Error obtaining XOAUTH2 token: "Failed to
authenticate additional scopes"
org.kde.pim.ksmtp: SMTP Socket error: QAbstractSocket::RemoteHostClosedError
"The remote host closed the connection"

When NO password (token) is set I see:
We have an error during reading password  "Entry not found"

Tryouts:

[ kmail - SMTP ]

User: sedat.di...@gmail.com
Pass:MYTOKEN

Encryption-1: STARTTLS
Port-1: 587
Authentication-1: XOAUTH2

Alternatively:

Encryption-2: SSL/TLS
Port-2: 465
Authentication-2: XOAUTH2

NOTE: On Gmail side nothing was changed - I can send patches via git
send-email but not KMail.

I use postgresql backend and can connect to the database and its tables.

[ ~/.config/akonadi/akonadiserverrc ]

[Debug]
Tracer=null

[%General]
Driver=QPSQL

[QPSQL]
Host=
InitDbPath=
Name=akonadi-dileks
Options=
ServerPath=
StartServer=false
- EOF -

Deleting all files in ~/.config/akonadi/ but keeping akonadiserverrc
plus deleting directory ~/.local/share/akonadi after stopping akonadi
did not help.

In May 2023 was my last working sent-email - I kept all test-emails
and are stored in sent-mail:

[ 
~/.local/share/local-mail/sent-mail/new/1683526703181.R196.iniza26703181.R196.iniza
]

From: dileks 
To: sedat.di...@gmail.com
Subject: KMail - Test 08-May-2023
Date: Mon, 08 May 2023 08:18:22 +0200
Message-ID: <2687898.mvXUDI8C0e@iniza>
X-KMail-Identity: 1886993645
X-KMail-Transport: 1190029663
X-KMail-Fcc: 20
X-KMail-Identity-Name: dileks
X-KMail-Transport-Name: dileks@gmail
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

KMail - Test 08-May-2023
- EOF -

Not sure where to dig into the woods.

Any help is much appreciated.

Thanks.

Best regards,
-Sedat-



Bug#1033462: kmail: Kmail fails to send emails via Google mail with "Failed to authenticate additional scopes"

2023-03-25 Thread Ariel Garcia
Package: kmail
Version: 4:22.12.3-1
Severity: normal
X-Debbugs-Cc: aog20...@gmail.com

Dear Maintainer,

I have two Google mail (@gmail.com) accounts. Both are configured to use
XOAUTH2 authentication for receiving (Imap / SSL / 993) and sending (smtp /
STARTTLS / 587).

Both accounts can retrieve the email, but ONLY ONE works for sending.
The other account fails to send email with the message "Failed to authenticate
additional scopes", and if i start akonadi in the shell i see the messages:

---
[SASL-XOAUTH2] - Requesting authID!
[SASL-XOAUTH2] - Requesting token!
[SASL-XOAUTH2] - filling prompts!
[SASL-XOAUTH2] - Requesting authID!
[SASL-XOAUTH2] - Requesting token!
org.kde.kgapi: Bad request, Google replied ' "{\n  \"error\":
\"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}" '
org.kde.pim.mailtransport.smtpplugin: Error obtaining XOAUTH2 token: "Failed to
authenticate additional scopes"
org.kde.pim.ksmtp: SMTP Socket error: QAbstractSocket::RemoteHostClosedError
"The remote host closed the connection"
-

As far as i can tell both accounts are set up identically. I even created the
failing one again (identity and sending account). Same error. I would be happy
to debug/investigate if helpful.


-- System Information:
Debian Release: 12.0
  APT prefers testing-security
  APT policy: (880, 'testing-security'), (880, 'testing'), (800, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-6-amd64 (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8), LANGUAGE=en_US
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages kmail depends on:
ii  akonadi-server   4:22.12.3-1
ii  kdepim-runtime   4:22.12.3-1
ii  kio  5.103.0-1
ii  libc62.36-8
ii  libgcc-s112.2.0-14
ii  libgpgmepp6  1.18.0-3+b1
ii  libkf5akonadiagentbase5 [libkf5akonadiagentbase5-22.12]  4:22.12.3-1
ii  libkf5akonadicontact5 [libkf5akonadicontact5-22.12]  4:22.12.3-1
ii  libkf5akonadicore5abi2 [libkf5akonadicore5-22.12]4:22.12.3-1
ii  libkf5akonadimime5 [libkf5akonadimime5-22.12]4:22.12.3-1
ii  libkf5akonadisearch-bin  4:22.12.3-1
ii  libkf5akonadisearch-plugins  4:22.12.3-1
ii  libkf5akonadisearchdebug5 [libkf5akonadisearchdebug5-22.12]  4:22.12.3-1
ii  libkf5akonadisearchpim5 [libkf5akonadisearchpim5-22.12]  4:22.12.3-1
ii  libkf5akonadiwidgets5abi1 [libkf5akonadiwidgets5-22.12]  4:22.12.3-1
ii  libkf5bookmarks5 5.103.0-1
ii  libkf5calendarcore5abi2  5:5.103.0-1
ii  libkf5calendarutils5 [libkf5calendarutils5-22.12]4:22.12.3-1
ii  libkf5codecs55.103.0-1
ii  libkf5completion55.103.0-1
ii  libkf5configcore55.103.0-1
ii  libkf5configgui5 5.103.0-1
ii  libkf5configwidgets5 5.103.0-1
ii  libkf5contacts5  5:5.103.0-1
ii  libkf5coreaddons55.103.0-1
ii  libkf5crash5 5.103.0-1
ii  libkf5dbusaddons55.103.0-1
ii  libkf5grantleetheme-plugins  22.12.3-1
ii  libkf5gravatar5abi2 [libkf5gravatar5-22.12]  4:22.12.3-1
ii  libkf5guiaddons5 5.103.0-1
ii  libkf5i18n5  5.103.0-1
ii  libkf5iconthemes55.103.0-1
ii  libkf5identitymanagement5 [libkf5identitymanagement5-22.12]  22.12.3-1
ii  libkf5identitymanagementwidgets5 [libkf5identitymanagementw  22.12.3-1
idgets5-22.12]
ii  libkf5itemmodels55.103.0-1
ii  libkf5itemviews5 5.103.0-1
ii  libkf5jobwidgets55.103.0-1
ii  libkf5kcmutils5  5.103.0-3
ii  libkf5kiocore5   5.103.0-1
ii  libkf5kiofilewidgets55.103.0-1
ii  libkf5kiogui55.103.0-1
ii