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

{'Error': 'BadAuthentication'} #54

Closed
HIT2022 opened this issue Aug 17, 2020 · 26 comments
Closed

{'Error': 'BadAuthentication'} #54

HIT2022 opened this issue Aug 17, 2020 · 26 comments

Comments

@HIT2022
Copy link

HIT2022 commented Aug 17, 2020

Hi. Does anything in particular need to be done for gpsoauth to be able to successfully return a master token? I keep getting this error against a 2FA enabled account.

from gpsoauth import perform_master_login, perform_oauth
res = perform_master_login('<mygmail', 'mygmailpwrd', 'myandroidid')
print (res)

[] Getting master token...
{'Error': 'BadAuthentication'}
[!] Could not get master token.
[
] Master token: None

@rithvikvibhu
Copy link
Owner

rithvikvibhu commented Aug 17, 2020

Yup. With a 2FA account, use an app password from https://myaccount.google.com/apppasswords
App: custom; Device: other; any name is fine.

For others (not using 2FA), enable less secure apps at https://myaccount.google.com/lesssecureapps

@HIT2022
Copy link
Author

HIT2022 commented Aug 18, 2020

I apologize for being a pain, but can you think of anything else? I've tried every variation I can think of (2FA w/ either google account pwd or custom app pwd, as well as non-2FA w/ less_secure enabled + google pwd or app pwd).... sometimes even with a hardcoded device_id (from my Android). I get the same response each time.

@rithvikvibhu
Copy link
Owner

Just to make sure, you're using just the username right? Not the complete email. Leaving out the @gmail.com

@HIT2022
Copy link
Author

HIT2022 commented Aug 19, 2020

Yessir. Running get_tokens.py, with just vars USERNAME and PASSWORD edited to mirror my username + (w/ 2-step-enabled attempts) apppword. Neither contain special characters. Attempts with a 2nd google account also fail, so you'd think this would just be user error on my part, but I can't see how

@rithvikvibhu
Copy link
Owner

I can't think of anything else.
Came across this and saw you've already replied. simon-weber/gpsoauth#24
Hopefully, they'll be able to figure it out.

@stale
Copy link

stale bot commented Sep 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 3, 2020
@stale stale bot closed this as completed Sep 10, 2020
@julo15
Copy link

julo15 commented Nov 1, 2020

I'm running into this as well. Tried with a 2FA account and a non-2FA account, with app passwords (and non-app passwords).

I'm on Mac, FWIW.

@rithvikvibhu rithvikvibhu reopened this Nov 2, 2020
@stale stale bot removed the stale label Nov 2, 2020
@rithvikvibhu
Copy link
Owner

rithvikvibhu commented Nov 2, 2020

For anyone new seeing this issue

Verify:

  • Do you have 2FA enabled? If so, then create an app password and use that instead.
  • Make sure the USERNAME variable is just the username, not the complete email address (@gmail.com).
  • Are the overrides unchanged? (all of them set to None is fine).

If it still doesn't work, then it probably is the same bug gpsoauth mentioned above. Track the issue in their repo. As of this comment, it looks os-dependent, not clear.

Keeping this issue open for visibility until it is fixed.

@vzRowan
Copy link

vzRowan commented Dec 20, 2020

I'm still getting the same error on macOS. Since 2 months have passed, is there any solution for this?

@rithvikvibhu
Copy link
Owner

@vzRowan have you seen #54 (comment) and still face the same problem? If yes, no one knows what the exact problem is, but trying a different computer has worked for some.

@vzRowan
Copy link

vzRowan commented Dec 20, 2020

@rithvikvibhu I tried it on my Windows PC yesterday, but got the same error. I guess i'll have to wait for a solution to come up.

@chvancooten
Copy link

Odd, my cron script for getting tokens based on this repo also suddenly stopped working after a password change. When trying to get a new master token I also face this issue. Tried with real and app password, on three different devices (1x windows 2x linux). All return the bad auth error 🤔

If anyone manages to fix this issue I'm very happy to hear how!

@rithvikvibhu
Copy link
Owner

rithvikvibhu commented Dec 20, 2020

I can confirm that with a custom device id (pick any mac address, without colons, all lowercase) + 2FA enabled account + app password works on Manjaro with python 3.8.6 and gpsoauth 0.4.1 and requests 2.24.0. Can someone try with this specific version of gpsoauth?

@chvancooten
Copy link

chvancooten commented Dec 20, 2020

@rithvikvibhu Whoa this is weird. Your comment prompted me to try different Python versions. For me it did not work on Python 3.7.5 (on Ubuntu) or 3.8.6 (on Windows/Kali Linux), but it does work on Python 3.6.9 on Ubuntu.

Made no changes otherwise, so may be worth a try to play with different Python versions for the people encountering this issue!

(Edit: For the record, also using gpsoauth 0.4.1)

@vzRowan
Copy link

vzRowan commented Dec 20, 2020

Tried with Python 3.6.9 and gpsoauth 0.4.1 on Ubuntu but no luck.

@vzRowan
Copy link

vzRowan commented Dec 24, 2020

Update: I read on the gpsoauth repo that downgrading to requests 2.23.0 worked for someone. So i tried this on my Mac with gpsoauth 0.4.1 and python 3.6.9 and it seems to work! Although i haven't tested the tokens i retrieved. But i think it's worth a try for others.

So try pip install requests==2.23.0 and running the script again.

@HIT2022
Copy link
Author

HIT2022 commented Dec 25, 2020

Downgrading requests has resolved my longwithstanding issue as well (although I likewise haven't had a chance to test the tokens being retrieved).

@rithvikvibhu
Copy link
Owner

Glad to hear! Can you mention which requests version did not and did work? I'll mention that somewhere.

Btw mine was always working and I confirmed working with all versions from 2.23.0 to 2.25.1 (https://requests.readthedocs.io/en/latest/community/updates/#release-history)

Someone with the problem please try this and see which ones don't work:

python --version

pip install requests==2.23.0
python script.py
pip install requests==2.24.0
python script.py
pip install requests==2.25.0
python script.py
pip install requests==2.25.1
python script.py

@DataPools
Copy link

DataPools commented Dec 27, 2020

Getting BadAuth on Ubuntu Server 16.04, python 3.5.2, requests 2.23 and requests 2.25

Is there any way to bypass this process together and generate an access token from the normal oauth login page and a scope?

EDIT: Updated to Python 3.6 and it worked!

@rithvikvibhu
Copy link
Owner

@DataPools Not that I'm aware of. You could try recreating the same request that the gpsoauth package sends. The request and payload is here https://github.com/simon-weber/gpsoauth/blob/master/gpsoauth/__init__.py

@velkrosmaak
Copy link

I'm still getting this on the latest version of python 3.6, with various versions of requests. I've also clocked continue here: https://accounts.google.com/DisplayUnlockCaptcha though I have created an app specific password since I use 2FA.

@rithvikvibhu
Copy link
Owner

@velkrosmaak do you have another account to try with? If that works, then can compare what's different with the accounts.

@velkrosmaak
Copy link

velkrosmaak commented Jan 21, 2021 via email

@HIT2022
Copy link
Author

HIT2022 commented Feb 5, 2021

See simon-weber/gpsoauth#24, this should be resolved

@Tony450
Copy link

Tony450 commented Apr 27, 2023

Hello, is this script still working as of April, 2023? I am having the "Bad Authentication" problem and I haven't been able to solve it yet. I have followed the steps that are explained in the comments but it doesn't work.

@rithvikvibhu
Copy link
Owner

@Tony450 I would check with https://github.com/simon-weber/gpsoauth to see if it works and if not, create an issue there.

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

No branches or pull requests

8 participants