Bug 464534 - Need to be able to override app name and app id
Summary: Need to be able to override app name and app id
Status: REPORTED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: EWS Resource (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-20 05:32 UTC by Aaron Williams
Modified: 2023-01-21 10:06 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Williams 2023-01-20 05:32:19 UTC
SUMMARY
I am trying to connect to my employer's Office365 mail server and am forced to use EWS, unfortunately, the app name "Akonadi" is not approved. There needs to be a method to override these settings to match Outlook. Changing the custom user agent does not seem to affect this.

STEPS TO REPRODUCE
1.  Try to connect to Office365 via EWS
2.  Watch it fail due to unsupported app name/id

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Krzysztof Nowicki 2023-01-20 13:08:05 UTC
This is already supported, although as advanced functionality and not visible from the user interface.

There is possibility to supply a custom OAuth2 Application Identifier (GUID) + Redirect URL. This pair is what identifies the application when performing OAuth2 authentication with the server.

The settings can be changed in the resource configuration file, which is located in ${HOME}/.config/akonadi_ews_resource_<x>rc, where <x> is the consecutive number of the resource - usually 0.

Inside, in the [General] section you can add the two parameters as configuration options:
OAuth2AppId=452b289a-7894-41d7-9cd4-d5275739fa27
OAuth2ReturnUri=urn:ietf:wg:oauth:2.0:oob

The above are the defaults which correspond to the Akonadi EWS resource app registered in Azure.

In your case it will be most useful to disguise as Outlook. I don't remember the Outlook's application ID, but it should be easy to find. The return URI in this case will most probably stay at its default value.
Comment 2 Aaron Williams 2023-01-21 09:43:17 UTC
Unfortunately I cannot get to the point where I can save the resource. The "OK" button is always greyed out, I'm assuming because it requires the "Try connect" to succeed with the URL https://outlook.office365.com/ews/exchange.asmx, so I have no way of creating this file to edit. I'm guessing the OK button is only enabled AFTER a successful connection, which of course will never happen.

I get the following output when I attempt OAUTH:
Error Code: 530021
Request Id: 88820ad5-aaaa-4878-a952-afc1117dea00
Correlation Id: 73f1d938-1c05-4227-a9b1-d47407373179
Timestamp: 2023-01-21T09:10:35.965Z
App name: Akonadi EWS
App id: 452b289a-7894-41d7-9cd4-d5275739fa27
IP address: xxx.x.xxx.xx
Device identifier: Not available
Device platform: Android
Device state: Unregistered
Comment 3 Aaron Williams 2023-01-21 10:06:27 UTC
It also looks like it does not send the custom user agent when trying to connect. If I manually (i.e. modify o365FakeUserAgent in ewsoauth.cpp) I get a different response where our oauth server is even more unhappy (I'm guessing the Mozilla user agent version is out of date). The Thunderbird user agent string says version 38. Currently, it is up to 102.6. This should probably be updated. I will attempt to change the office 365 user agent and see if that makes a difference.