glocaltokens icon indicating copy to clipboard operation
glocaltokens copied to clipboard

Can't get token on python 3.10

Open quetzal opened this issue 2 years ago • 7 comments

Hello

Describe the bug When I use the script on the readme, it work great with python 3.9 but not with 3.10

To Reproduce Steps to reproduce the behavior:

Install ubuntu 20.04. Install glocaltokens Install python3-pip pip3 install glocaltokens Use the test script, it work.

Upgrade ubuntu to 22.04 (which come with python 3.10) Reinstall pip3 install glocaltokens Retry the same script: "Could not get master token."

I don't know if the problem come from the python version or the dependances, but I first have the problem with a fresh ubuntu 22.04. Then I test on 20.04 without error, so I try with a fresh vm with 20.04 and then upgrading it to confirm the problem

quetzal avatar Feb 21 '23 21:02 quetzal

I suspect that your requests are failing with a well know "Can't Authenticate" issue. I don't think the problem is a new python version, quite possible that when you upgrade your ubuntu to 22.04 it comes with other dependencies that mismatch and cause an issue. See this thread, it would be awesome if you could test your both setups and provide us with more information.

compare versions of Python, OpenSSL, requests. And probably try to create identical virtual envs with the same versions of all packages and python itself, you can use poetry for this and share lock file between setups. And probably even build Python yourself to guarantee you're using exact the same revision.

leikoilja avatar Feb 22 '23 07:02 leikoilja

Hello,

On ubuntu 22.04 I installed Python3.9 and 3.11 from ppa:deadsnakes/ppa I installed glocaltokens via: python3.9 -m pip install glocaltokens Successfully installed async-timeout-4.0.2 certifi-2022.12.7 charset-normalizer-3.0.1 glocaltokens-0.6.9 gpsoauth-1.0.2 grpcio-1.51.3 idna-3.4 ifaddr-0.2.0 protobuf-3.20.3 pycryptodomex-3.17 requests-2.28.2 simplejson-3.18.3 urllib3-1.26.14 zeroconf-0.47.3

python3.11 -m pip install glocaltokens Successfully installed certifi-2022.12.7 charset-normalizer-3.0.1 glocaltokens-0.6.9 gpsoauth-1.0.2 grpcio-1.51.3 idna-3.4 ifaddr-0.2.0 protobuf-3.20.3 pycryptodomex-3.17 requests-2.28.2 simplejson-3.18.3 urllib3-1.26.14 zeroconf-0.47.3

I've tryed with python3.8 too. They doesn't work. I need to test all these on ubuntu 20.04 too ! On 22.04: openssl 3.0.2-0ubuntu1.8

quetzal avatar Feb 22 '23 08:02 quetzal

On ubuntu 20.04, with Python3.10: Successfully installed async-timeout-4.0.2 charset-normalizer-3.0.1 glocaltokens-0.6.9 gpsoauth-1.0.2 grpcio-1.51.3 ifaddr-0.2.0 protobuf-3.20.3 pycryptodomex-3.17 requests-2.28.2 simplejson-3.18.3 zeroconf-0.47.3

So all versions look the same.

Auth work with ubuntu 20.04. So it's definitively not linked to python version or to requests.

It work with python3.11 too: python3.11 -m pip install glocaltokens Successfully installed charset-normalizer-3.0.1 glocaltokens-0.6.9 gpsoauth-1.0.2 grpcio-1.51.3 ifaddr-0.2.0 protobuf-3.20.3 pycryptodomex-3.17 requests-2.28.2 simplejson-3.18.3 zeroconf-0.47.3

It's working. openssl 1.1.1f-1ubuntu2.17

Now I'm compiling openssl 3 on ubuntu 20.04 to see if it's linked.

quetzal avatar Feb 22 '23 08:02 quetzal

On ubuntu 20.04, with openssl 3.0.2 compiled it still work :/

I've tryed with the openssl.cnf of the working host but still doesn't work on ubuntu 22.04

quetzal avatar Feb 22 '23 09:02 quetzal

Hi, I am having the same issue. This relates to the google_home integration for home-assistant so I have logged a issue there, but potentially they will refer to this project. https://github.com/leikoilja/ha-google-home/issues/675
I too run Ubuntu 22.04 and Python 3.11 however it does not appear to be Python version related as had same issue on earlier Python versions. This was working on older 20.04 server running Python 3.10.
I tried using get_tokens.py and was unable to retrieve tokens. thanks gb

bagelos avatar Mar 06 '23 08:03 bagelos

Well, i solved this running an Ubuntu 22 server and using a docker container for it. According to this issue a urllib3 < 2 is needed.

I'm using the following Dockerfile and it works like a charm using a master_token. I had to add "urllib3<2" to the pip install ..

FROM python:3.9

WORKDIR /opt/glocaltokens-data

RUN pip install "urllib3<2" glocaltokens

CMD ["/bin/bash", "/run.sh"]

ChalyFlavour avatar Jul 13 '23 08:07 ChalyFlavour

This fix is not working on my end right now (Tryed with two different accounts)

JulienDeveaux avatar Aug 18 '23 18:08 JulienDeveaux