Author Topic: Oauth2 proxy  (Read 1344 times)

aziz

  • Newbie
  • *
  • Posts: 13
  • Karma: +2/-0
    • View Profile
Oauth2 proxy
« on: May 20, 2025, 05:53:00 pm »
While surfing the web, I stumbled upon https://github.com/simonrob/email-oauth2-proxy

I did not look deep into it, but this might be a solution to connect mailclients without OAuth2 support to servers that require it.
More and more servers are requiring OAuth2, so a proxy like this one could be very useful.

Registering new app credentials might be cumbersome though.
Maybe someone with more knowledge about OAuth2 might educate us, how to set this up?

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5412
  • Karma: +129/-1
    • View Profile
Re: Oauth2 proxy
« Reply #1 on: May 21, 2025, 05:17:44 am »
It's an interesting project, though I wish I knew where the bug is in our Thunderbird as oauth2 should just work.
It's been a long time (perhaps Firefox 10 development?) since I've played with this Python stuff. So far I've done,
Code: [Select]
yum install python3-setuptools python3-setuptools_scm
python -m ensurepip --upgrade
python -m pip install --upgrade pip
python -m pip install -r requirements-core.txt

Which results in this error, (rerunning the error causing command)
Code: [Select]
K:\work\email-oauth2-proxy>python -m pip install cryptography
WARNING: The directory 'w:/home/.cache/pip' or its parent directory is not owned
 or is not writable by the current user. The cache has been disabled. Check the
permissions and owner of that directory. If executing pip with sudo, you should
use sudo's -H flag.
Collecting cryptography
  Downloading cryptography-45.0.2.tar.gz (743 kB)
     --------------------------------------- 743.9/743.9 kB 2.3 MB/s eta 0:00:00

ERROR: Invalid member in the tar file h:/tmp/pip-unpack-ye_q2rxg/cryptography-45
.0.2.tar.gz: '.gitattributes' would be extracted to 'h:/tmp/pip-install-zhxi8tme
/cryptography_a6b377d357bc4600a896c1f43f6d019b/.gitattributes', which is outside
 the destination

So it doesn't like the idea of installing a hidden file (.gitattributes) in %TMPDIR%.
According to the documentation, shouldn't need the -m parameter either, but it results in,
Code: [Select]
K:\work\email-oauth2-proxy>python  pip install cryptography
W:\USR\BIN\python.exe: can't open file 'K:/work/email-oauth2-proxy/pip': [Errno
2] No such file or directory

A python path issue?
Perhaps using _virtualenv would work if I can remember how to do it.



Dave Yeo

  • Hero Member
  • *****
  • Posts: 5412
  • Karma: +129/-1
    • View Profile
Re: Oauth2 proxy
« Reply #2 on: May 21, 2025, 06:07:00 am »
A python path issue?
Perhaps using _virtualenv would work if I can remember how to do it.

Seems Python3 comes with a light weight virtualenv, https://realpython.com/python-virtual-environments-a-primer/#linux-1.
Need to use bash, still the same problem,
Code: [Select]
bash-5.0# python -m pip install emailproxy
WARNING: The directory 'w:/home/.cache/pip' or its parent directory is not owned
 or is not writable by the current user. The cache has been disabled. Check the
permissions and owner of that directory. If executing pip with sudo, you should
use sudo's -H flag.
Collecting emailproxy
  Downloading emailproxy-2025.3.14-py3-none-any.whl.metadata (38 kB)
Collecting cryptography>=2.2 (from emailproxy)
  Downloading cryptography-45.0.2.tar.gz (743 kB)
     --------------------------- ----------- 524.3/743.9 kB 2.8 MB/s eta 0:00:01
     --------------------------------------- 743.9/743.9 kB 2.8 MB/s eta 0:00:00

ERROR: Invalid member in the tar file h:/tmp/pip-unpack-prwpg07h/cryptography-45
.0.2.tar.gz: '.gitattributes' would be extracted to 'h:/tmp/pip-install-eriz9zy6
/cryptography_7cbb1fea01e946c08b459fde6f7c0682/.gitattributes', which is outside
 the destination