Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icon and menu not showing #318

Closed
stephansigg opened this issue Jan 15, 2025 · 9 comments
Closed

icon and menu not showing #318

stephansigg opened this issue Jan 15, 2025 · 9 comments

Comments

@stephansigg
Copy link

Hello,

I have been using the proxy in combination with kmail2 for several years and it has been working extremely well - Thanks a lot for your excellent work!

Recently, I have installed two new systems where I can not get it to work (both kubuntu 24.04.1 LTS; have tried with wayland and X11).

When starting emailproxy.py, something appears in the system tray (X11: empty space; wayland: white square). I can hover over it and it shows a tooltip saying "Email OAuth 2.0 Proxy". However, I am not otherwise able to interact with it and particularly can not open the menu.

I went through some similar-sounding problem descriptions here (e.g. #1 (comment) and #305 (comment) as well as https://pywebview.flowrl.com/guide/installation.html#dependencies and https://pystray.readthedocs.io/en/latest/faq.html), however, with no success.

The installation completed without errors and when I attempt to start the client, it tells me
"Initialised Email OAuth 2.0 Proxy - listening for authentication requests. Connect your email client to begin"

Everything looks OK to me, so I am a little lost - Would you have any ideas?

Thanks,

Stephan

@simonrob
Copy link
Owner

Linux GUI issues are a longstanding challenge, and you're looking at the right sort of sources. I can't really suggest anything else here I'm afraid.

However, this shouldn't stop you using the proxy – the GUI is optional. Have you tried --no-gui mode to get things set up?

@stephansigg
Copy link
Author

stephansigg commented Jan 16, 2025

Thank you, Simon,

when I start the proxy with --no-gui --local-server-auth, I was able to open the authentication window one time by copying the link into the browser. However, I had a typo in my config and hence it could not connect to the local server.

After that, I always get

Local server auth mode (localhost:80): unable to start local server. Please check that redirect_uri for [email protected] is unique across accounts, specifies a port number, and is not already in use. See the documentation in the proxy's sample configuration file. PermissionError(13, 'Permission denied')

I have
redirect_uri = http://localhost

local_address = localhost
server_address = outlook.office365.com
server_port = 993

This is probably easy to fix - will look into this with some more time over the weekend.

@stephansigg
Copy link
Author

stephansigg commented Feb 2, 2025

I have to admit that I did not get any further than the above.

The issue appears to be that the local server is not started but I am not able to find the solution.

This is part of the log:

2025-02-02 21:28:47: New incoming connection to IMAP server at localhost:1993 (unsecured) proxying outlook.office365.com:993 (SSL/TLS) 2025-02-02 21:28:47: Accepting new connection from [::1]:53062 to IMAP server at localhost:1993 (unsecured) proxying outlook.office365.com:993 (SSL/TLS) 2025-02-02 21:28:47: IMAP ([::1]:53062-{[::1]:1993}-outlook.office365.com:993) --> [ Client connected ] 2025-02-02 21:28:47: IMAP ([::1]:53062-{[::1]:1993}-outlook.office365.com:993) <-> [ Starting TLS handshake ] 2025-02-02 21:28:48: IMAP ([::1]:53062-{[::1]:1993}-outlook.office365.com:993) <-> [ TLSv1.2 handshake complete ] 2025-02-02 21:28:48: IMAP ([::1]:53062-{[::1]:1993}-outlook.office365.com:993) <-- b'* OK The Microsoft Exchange IMAP4 service is ready. [RwBWADMAUABFAFAARgAwADAAMAAwADIAQgBBAEUALgBTAFcARQBQADIAOAAwAC4AUABSAE8ARAAuAE8AVQBUAEwATwBPAEsALgBDAE8ATQA=]\r\n' 2025-02-02 21:28:48: IMAP ([::1]:53062-{[::1]:1993}-outlook.office365.com:993) <-- b'* OK The Microsoft Exchange IMAP4 service is ready. [RwBWADMAUABFAFAARgAwADAAMAAwADIAQgBBAEUALgBTAFcARQBQADIAOAAwAC4AUABSAE8ARAAuAE8AVQBUAEwATwBPAEsALgBDAE8ATQA=]\r\n' 2025-02-02 21:28:48: IMAP ([::1]:53062-{[::1]:1993}-outlook.office365.com:993) --> b'A000001 LOGIN [[ Credentials removed from proxy log ]]\r\n' 2025-02-02 21:28:48: Authorisation request received for [email protected] (local server auth mode) 2025-02-02 21:28:48: Email OAuth 2.0 Proxy Local server auth mode: please authorise a request for account [email protected] 2025-02-02 21:28:48: Local server auth mode (localhost:80): starting server to listen for authentication response 2025-02-02 21:28:48: Local server auth mode (localhost:80): unable to start local server. Please check that redirect_uri for [email protected] is unique across accounts, specifies a port number, and is not already in use. See the documentation in the proxy's sample configuration file. PermissionError(13, 'Permission denied') 2025-02-02 21:28:48: Authorisation result error for account [email protected] - aborting login. No-GUI authorisation request failed or timed out for account [email protected] 2025-02-02 21:28:48: IMAP ([::1]:53062-{[::1]:1993}-outlook.office365.com:993) <-- b'A000001 NO LOGIN Email OAuth 2.0 Proxy: Login failed for account [email protected]: No-GUI authorisation request failed or timed out for account [email protected]\r\n'

I noticed that the server is started at localhost:80 - and this even though I specified localhost:1993 in the config file.

Also, when I had started emailproxy with --no-gui for the first time, it actually did specify a server address, which I called and authenticated before the process produced an error (which I unfortunately did not log). Now, the server address is no longer produced (which may be OK as I think that the connection is now established directly - just mentioning in case this makes any difference)

Will be digging further - just wanted to share that I am still searching.

@simonrob
Copy link
Owner

simonrob commented Feb 3, 2025

Please could you post your configuration file?

@stephansigg
Copy link
Author

stephansigg commented Feb 5, 2025

[Email OAuth 2.0 Proxy configuration file]

[Server setup]

[IMAP-1993]
local_address = localhost:1993
server_address = outlook.office365.com
server_port = 993

[Account setup]

[[email protected]]
permission_url = https://login.microsoftonline.com/common/oauth2/v2.0/authorize
token_url = https://login.microsoftonline.com/common/oauth2/v2.0/token
oauth2_scope = https://outlook.office365.com/IMAP.AccessAsUser.All https://outlook.office365.com/SMTP.Send offline_access
redirect_uri = http://localhost
client_id =
client_secret =

@stephansigg
Copy link
Author

This is the file I have been using currently (I omitted the client_id and client_secret).
localhost:1993 I tried as I was desparate, though also localhost does not work.

@simonrob
Copy link
Owner

simonrob commented Feb 5, 2025

Your redirect_uri value doesn't have a port specified, which is why the server is starting on port 80. Try this (and see the documentation):

[IMAP-1993]
local_address = localhost
server_address = outlook.office365.com
server_port = 993

[[email protected]]
permission_url = https://login.microsoftonline.com/common/oauth2/v2.0/authorize
token_url = https://login.microsoftonline.com/common/oauth2/v2.0/token
oauth2_scope = https://outlook.office365.com/IMAP.AccessAsUser.All https://outlook.office365.com/SMTP.Send offline_access
redirect_uri = http://localhost:1993

This looks to be what you're trying to do, but it still won't work because the proxy itself is running an IMAP server on port 1993 already. So, try redirect_uri = http://localhost:8080 or similar, choosing a port that isn't otherwise in use.

Note that the port for the IMAP server is specified in its configuration entry (i.e., [IMAP-1993] = port 1993). I'll think about how to make this clearer and/or detect error like the one in your configuration.

@simonrob
Copy link
Owner

I'm going to assume this has now been resolved and will close this issue.

@stephansigg
Copy link
Author

Apologies, for not yet answering.
it works now.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants