HTTP Code 401
benjaminnyc opened this issue · comments
Greetings. I am trying to get EWR set up in Kmail, but I'm running into error code 401. My settings are identical to Evolution-EWS. Some odd behavior is this:
Domain checked but blank
Try Connect returns no error and results in the log below, but clicking OK to add account results in 401
log_ews_resource_request: Starting GetFolder request (1 folders)
log_ews_resource_proto: data KIO::TransferJob(0x2a401a0) ""
log_ews_resource_proto: response dumped to "/tmp/akonadi-ews-Xe6csXi/ews_xmldump_aqq3890.xml"
log_ews_resource: Failed to process EWS request - HTTP code 401
log_ews_resource_proto: "<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/\" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types\">soap:Header<t:RequestServerVersion Version="Exchange2007_SP1"/></soap:Header>soap:Body<m:GetFolder><m:FolderShape><t:BaseShape>IdOnly</t:BaseShape></m:FolderShape><m:FolderIds><t:DistinguishedFolderId Id="inbox"/></m:FolderIds></m:GetFolder></soap:Body></soap:Envelope>\n"
Domain checked but filled in with proper domain
401 & this log
log_ews_resource_proto: data KIO::TransferJob(0x280acf0) ""
log_ews_resource_proto: response dumped to "/tmp/akonadi-ews-Xe6csXi/ews_xmldump_meo3890.xml"
log_ews_resource: Failed to process EWS request - HTTP code 401
log_ews_resource: Failed to process EWS request - HTTP code 401
Domain unchecked
401 & this log
log_ews_resource_proto: data KIO::TransferJob(0x280acf0) ""
log_ews_resource_proto: response dumped to "/tmp/akonadi-ews-Xe6csXi/ews_xmldump_meo3890.xml"
log_ews_resource: Failed to process EWS request - HTTP code 401
log_ews_resource: Failed to process EWS request - HTTP code 401
I carefully read the debugging instructions, and I have attached my logs here that have info, but but most are 0 bytes / 100% empty, so they can't be uploaded here.
OneDrive link:
https://1drv.ms/f/s!AkxzHMvKAVWHh9A0j8Pq_ImdZcVSNg
Not sure what I am doing wrong. Sorry if I'm not being descriptive.
I'm on Arch Linux, using Plasma 5.9.
I appreciate your help in advance.
Thanks!
Benjamin
Does the dev help with issues here?
Does the dev help with issues here?
The dev has a life... I wish I could spend more time on akonadi-ews, but that is not possible ATM.
Could you try to enable kio_http debug? Edit the ~/.config/QtProject/qtlogging.ini
file and add the following line to the Rules
secion:
kf5.kio.kio_http.debug=true
Important: Before trying to reproduce this with logs enabled make sure to change your password temporarily as the log will contain hashes, which could help recover it.
With the logs enabled reproduce the problem and look into the Systemd journal (or ~/.xsession-errors if you're not running Systemd). You should see quite verbose logging from kio_http. If that's not the case you can try to restart your KDE session.
Please post the log here or send to me by e-mail to krissn@op.pl.
I figured it out. For my "User Name" I was using my email address, because on every other email client (both computer and phone), I have used:
domain\email
for
domain\username
In this case, I had to locate and use my real Exchange username, which was a name I had never seen before. Using that, it worked.
In the previous company I've worked I was using my username and AD domain name. In the new company this didn't work well and I had to use my e-mail address with no domain (checkbox unchecked). In both cases Exchange is hosted in Microsoft cloud.
I guess it depends on how everything is configured.
But this is the same company. For instance, when adding this Exchange account to my phone, it asks for Domain and Username, and I use:
domain\email
However with your client, I cannot use email for username, I had to locate the odd username that I didn't even know existed. It wasn't the letters before the @ symbol on my email address.
So it's no the way the server is configured, rather the way the client works. Glad I figure it out.
Client working nicely! Thank you!
It's possible that the other clients are using the domain\email to do some autodiscovery, retrieve the AD username and use it instead. Might be something to look at in order to be more user-friendly in the future and not require the user to know MS AD internals.
I'll keep this one open as a reminder to do that.
Thanks, or maybe just a note in the setup that this field is looking for the real username, not the email address. That would be a temporary alternative.
I also keep receiving 401 errors. I think kio_http has problems handling the response from the server.
I tried connecting to the EWS url from Firefox, and in the "network" tab of the developer tools, I can clearly see two 401 responses, followed by one 200 OK response.
The first request is responded with "401 Anonymous Request Disallowed", and has a WWW-Authenticate:"Negotiate\nNTLM\nBasic realm="mail..de"" header
The second request sent by FF has a "Authorization: NTLM\nTlRxxxxxxxxxx=" and a Cookie header and is answered with "401 Unauthorized", containing a "WWW-Authenticate: NTLM\nTIRxxxx\nNegotiate\nBasic realm="mail..de"" header.
Only the third request, this time with a much longer "Authorization: NTLM\nTIRxxxxxxxx" header, is answered with 200 OK.
If I try the same using konqueror, I am actually asked for the user/password twice.
Hello I've encoutered somewhat similar problem with my setup.
The real trouble AFAIK in my case is this log message
"kf5.kio.kio_http: looks like the user canceled the authentication dialog"
everything else seems to be OK
on my dialog window in main tab with Exchange settings ther is a "Try connect" button which receives 200 OK from Exchange server (but obviously uses username and password form the same settings window).
The second tab with subscriptions is showing me "failed to retrieve folder list", which is probably fine due to 401 received from Exchange server. (reload list button gets those 401 errors).
The strange thing in logs is the line mentioned before. I've never been prompted for any credentials, and kio clearly tries to use them an fails miserably.
In my kwallet I see folder for akonadi-ews but it is unpopulated by any data.
Could anyone help me with this, or is it some kind of bug?
I have ran into what I think is that same issue when I changed my email password.
In my case, what I had to do was open kwalletmanager, manually switch the password to the new one (despite having the right one in the settings dialog!), then kill akonadi_ews_resource. Then it worked.
@FeepingCreature, what you have experienced is KDE bug 393002, which now be fixed.
Just a hint for others coming here with the same issue as me - if this errors occurs in KMail/KOrganizer/... during EWS autodiscovery, you can try to manually enter the EWS URL. You can obtain it with https://support.gfi.com/hc/en-us/articles/360012994253-How-to-obtain-the-Exchange-Web-Services-EWS-URL.
Just a hint for others coming here with the same issue as me - if this errors occurs in KMail/KOrganizer/... during EWS autodiscovery, you can try to manually enter the EWS URL. You can obtain it with https://support.gfi.com/hc/en-us/articles/360012994253-How-to-obtain-the-Exchange-Web-Services-EWS-URL.
It doesn't work for me. It seems like it's going to, a pop-up requests my password and everything seems fine, but then I cannot move further (grayed out Ok button and no info is saved in kwallet).
EDIT: using OAuth2 (Office 365)
Hi,
I just set up an exchange mailbox in kmail using akonadi-ews. I just wanted to confirm that it is still necessary to find out the exchange username to successfully connect to the server.
However this issue which includes enough information to point me in the right direction was very easy to find :)