Open therealchjones opened 2 years ago
Getting the same issue as you, just simply Bad Authentication (even tried with app passwords).
For me, the Bad Authentication error is solved by Installing requests==2.23.0
@kallix which version of python are you on? In order to run requests 2.23.0 I need to downgrade to urllib3==1.25.11 but then that crashes with AttributeError: module 'urllib3.util.ssl_' has no attribute 'OP_NO_TICKET'
, which is fixed in 1.26.x. I am currently on Python 3.10.
I run only python3.8 and 3.9. Never tested with 3.10.
@marty0678 are you trying to login with an email and pass (hence trying to register a fake device), or do you already have the gsfId and AuthToken already? (warning: I believe a gsfId / AuthToken couple has a one-month validity -- not more)
In my experience: Login with an email and password does require requests==2.23.0. However, login with gsfId and AuthToken works with any version of requests. (you can quickly login from a machine with py 3.9 and request==2.23.0, get the gsfId and authoken, and move those to your first machine.)
On one Google account, the gsfId and AuthToken is still valid, so when I log in with that method it's working at the moment but like you said it'll expire so I can't count on it for much longer.
One new/existing accounts that the tokens have expired (or never received one), the email/password is what is failing. When I can get back to this in a few hours, I was planning on what you were suggesting, creating a venv with python 3.9 and requests 2.23 to try to get working as I'm currently running this API in a larger app that will be difficult to migrate back to python 3.9.
So if this works I will bundle up a Python 3.9 app separately and have the 3.10 app make calls to it. But first, need to confirm I can get it working with 3.9 and requests 2.23 as you said. Thanks for your help, I'll update this thread when I get back to this!
Applied https://github.com/NoMore201/googleplay-api/pull/161 on top of gentoolinux fix to Bad Authentication (https://github.com/gentoolinux/googleplay-api/commit/6e4c7a47b59f2a1a512b05380127f87369e308ff). Be aware to apply 161 inline with gentoolinux patch. Works for me and is independent of requests version.
Thanks for the link to https://github.com/gentoolinux/googleplay-api/commit/6e4c7a47b59f2a1a512b05380127f87369e308ff but I already had that fix from last year.
I eventually got it to work by reverting urllib3 to 1.25.11 (or 1.25.10) then replacing the ssl_.OP_NO_TICKET
with the default value from the newer SSL library that contains that missing option in 1.25.x.
You can see my PR in my fork and that specific change here: https://github.com/marty0678/googleplay-api/commit/a64cb59f8c139f549b9650d66e68b1f03d158b7e#diff-8603cb7eaa65628bc3cc25edaf349cf45a979eebf3e380eff28b66f735575165R63
Here's what I've been able to get to work, all thanks to @marty0678's fork marty0678/googleplay-api
git clone https://github.com/marty0678/googleplay-api
cd googleplay-api
python3 -m venv .venv
. .venv/bin/activate
pip3 install -r requirements.txt
pip3 install --upgrade protobuf
python3 setup.py build
pip3 install .
python3 test/obb_download_test.py -e <email> -p <password>
For what it's worth, this is Python 3.9.2 installed via Homebrew running on macOS Monterey 12.4, using a gmail account with 2FA and using an app password, having previously logged into the Play Store on an emulator and accepted all terms.
And again, thanks @marty0678!
Made it works with python 3.10, thx @marty0678
@marty0678 are you able to run your library on Linux? I would like run on AWS but failed to do so. when i tried on my mac (brew python 3.10) it works like magic. Thanks BTW.
@marty0678 are you able to run your library on Linux? I would like run on AWS but failed to do so. when i tried on my mac (brew python 3.10) it works like magic. Thanks BTW.
Haven't tried (I know one guy uses my app via WINE that incorporates this library, but that doesn't really count haha). AFAIK everything in this library is cross-compatible though, but I've only made some minor tweaks from the upstream and haven't really looked into the entire source code aside for what I've just done to get it to work.
Hello there! Thank you everyone for your answers.
I'm still stuck with this issue. I've tried installing a requests=2.23.0, the fork proposed by @marty0678, the @therealchjones proposal and also tried 2FA with app password configured in my Google account. I'm running Python 3.8. Does anyone have any clue of what can be happening?
Hello there! Thank you everyone for your answers.
I'm still stuck with this issue. I've tried installing a requests=2.23.0, the fork proposed by @marty0678, the @therealchjones proposal and also tried 2FA with app password configured in my Google account. I'm running Python 3.8. Does anyone have any clue of what can be happening?
Hi David, same issue here with the same configuration, I do not know what is happening. Two days ago it was working perfectly
I run gpapi on windows 11 and linux (ubuntu 22 with openssl 3).
With same version of python 3.10, gpapi==git+https://github.com/marty0678/googleplay-api, requests==2.23.0, urllib3==1.25.0, I can login on windows with email and app password, but received BadAuthentication on linux (ubuntu 22 with openssl 3).
Hope this helps.
@mcozar99 & @DavidRodriguezTorrado, please try python 3.9; it doesn't seem to work with 3.8 (though I haven't looked into why).
Here's what I've been able to get to work, all thanks to @marty0678's fork marty0678/googleplay-api
git clone https://github.com/marty0678/googleplay-api cd googleplay-api python3 -m venv .venv . .venv/bin/activate pip3 install -r requirements.txt pip3 install --upgrade protobuf python3 setup.py build pip3 install . python3 test/obb_download_test.py -e <email> -p <password>
For what it's worth, this is Python 3.9.2 installed via Homebrew running on macOS Monterey 12.4, using a gmail account with 2FA and using an app password, having previously logged into the Play Store on an emulator and accepted all terms.
And again, thanks @marty0678!
I have done everything but it keeps getting bad authentication, I'm using ubuntu 22.04 and I have tried with python 3.8, 3.9 and 3.10. I logged in first time too.
Here's what I've been able to get to work, all thanks to @marty0678's fork marty0678/googleplay-api
git clone https://github.com/marty0678/googleplay-api cd googleplay-api python3 -m venv .venv . .venv/bin/activate pip3 install -r requirements.txt pip3 install --upgrade protobuf python3 setup.py build pip3 install . python3 test/obb_download_test.py -e <email> -p <password>
For what it's worth, this is Python 3.9.2 installed via Homebrew running on macOS Monterey 12.4, using a gmail account with 2FA and using an app password, having previously logged into the Play Store on an emulator and accepted all terms. And again, thanks @marty0678!
I have done everything but it keeps getting bad authentication, I'm using ubuntu 22.04 and I have tried with python 3.8, 3.9 and 3.10. I logged in first time too.
I usually need to enable 2FA on the account, enable an app password to log in, and then sometimes (depending on how often I'm doing it) use a VPN for auth to finally work.
Here's what I've been able to get to work, all thanks to @marty0678's fork marty0678/googleplay-api
git clone https://github.com/marty0678/googleplay-api cd googleplay-api python3 -m venv .venv . .venv/bin/activate pip3 install -r requirements.txt pip3 install --upgrade protobuf python3 setup.py build pip3 install . python3 test/obb_download_test.py -e <email> -p <password>
For what it's worth, this is Python 3.9.2 installed via Homebrew running on macOS Monterey 12.4, using a gmail account with 2FA and using an app password, having previously logged into the Play Store on an emulator and accepted all terms. And again, thanks @marty0678!
I have done everything but it keeps getting bad authentication, I'm using ubuntu 22.04 and I have tried with python 3.8, 3.9 and 3.10. I logged in first time too.
I usually need to enable 2FA on the account, enable an app password to log in, and then sometimes (depending on how often I'm doing it) use a VPN for auth to finally work.
Use the app password as the password?
Here's what I've been able to get to work, all thanks to @marty0678's fork marty0678/googleplay-api
git clone https://github.com/marty0678/googleplay-api cd googleplay-api python3 -m venv .venv . .venv/bin/activate pip3 install -r requirements.txt pip3 install --upgrade protobuf python3 setup.py build pip3 install . python3 test/obb_download_test.py -e <email> -p <password>
For what it's worth, this is Python 3.9.2 installed via Homebrew running on macOS Monterey 12.4, using a gmail account with 2FA and using an app password, having previously logged into the Play Store on an emulator and accepted all terms.
And again, thanks @marty0678!
I am trying to run a script in Google Cloud Shell but I am getting this error: TypeError:"Descriptors cannot be installed directly"
Traceback (most recent call last):
File "/home/gcpapk/googleplay-api/test/obb_download_test.py", line 1, in <module>
from gpapi.googleplay import GooglePlayAPI
File "/home/gcpapk/googleplay-api/.venv/lib/python3.9/site-packages/gpapi/googleplay.py", line 18, in <module>
from . import googleplay_pb2, config, utils
File "/home/gcpapk/googleplay-api/.venv/lib/python3.9/site-packages/gpapi/googleplay_pb2.py", line 36, in <module>
_descriptor.FieldDescriptor(
File "/home/gcpapk/googleplay-api/.venv/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 560, in __new__
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
It worked by downgrading.
git clone https://github.com/marty0678/googleplay-api
cd googleplay-api
python3 -m venv .venv
. .venv/bin/activate
pip3 install -r requirements.txt
pip3 install --upgrade protobuf==3.20.0
python3 setup.py build
pip3 install .
python3 test/obb_download_test.py -e <email> -p <password>
Like others, I was using gpapi (and some higher-level tools) quite successfully until a few weeks ago, when I was hit by #159. However, in attempting to test #161, I'm now finding that instead I'm getting only
'Error=BadAuthentication'
at every login attempt, both with the current codebase, the current PyPi package, and the PR code. Additionally, this seems to occur with accounts that were previously working as well as new accounts, happens whether or not the accounts have been used in an emulator to access the Play Store and accept terms and conditions, happens on different operating systems (current macOS and old Ubuntu 16.04, both with python 3.9) with different IPs. Any ideas?