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

Can't get token on python 3.10 #332

Open
quetzal opened this issue Feb 21, 2023 · 7 comments
Open

Can't get token on python 3.10 #332

quetzal opened this issue Feb 21, 2023 · 7 comments

Comments

@quetzal
Copy link

quetzal commented Feb 21, 2023

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

@leikoilja
Copy link
Owner

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.

@quetzal
Copy link
Author

quetzal commented Feb 22, 2023

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
Copy link
Author

quetzal commented Feb 22, 2023

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
Copy link
Author

quetzal commented Feb 22, 2023

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

@bagelos
Copy link

bagelos commented Mar 6, 2023

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. leikoilja/ha-google-home#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

@ChalyFlavour
Copy link

ChalyFlavour commented Jul 13, 2023

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"]

@JulienDeveaux
Copy link

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

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

5 participants