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

Login failed with "{'Error': 'BadAuthentication'}" #14

Open
djtimca opened this issue Nov 17, 2020 · 17 comments
Open

Login failed with "{'Error': 'BadAuthentication'}" #14

djtimca opened this issue Nov 17, 2020 · 17 comments

Comments

@djtimca
Copy link

djtimca commented Nov 17, 2020

I removed the integration from Home Assistant as part of testing of my other issue, but when I go back to reinstall / configure the integration again I get a Login filed error in the UI.

I have created a new App Password and it still doesn't work.

I assume some credentials may be cached from a previous installation?

@Drakulix
Copy link
Owner

Drakulix commented Nov 17, 2020

I already was pretty certain, that I frequently deleted and re-added the integration during development, but to be extra safe, I just removed and added the integration three times without any issues (with different app passwords).

I guess this issue related to your general connection problems with this integration #11.

@djtimca
Copy link
Author

djtimca commented Nov 17, 2020

It looks like it is related, just not sure which is causing which. I managed to set something up locally and I am getting back {'Error': 'BadAuthentication'} from the get_master_token call. Based on the open issues in gpsoauth it looks like this is something that has come up periodically and nobody has nailed down where it comes from. Going to try a few other things to see if I can't diagnose options.

@Drakulix
Copy link
Owner

Upstream issues:
rithvikvibhu/GHLocalApi#54
simon-weber/gpsoauth#24

@Drakulix Drakulix changed the title Login failed error if you remove and re-add the integration Login failed with "{'Error': 'BadAuthentication'} Nov 18, 2020
@Drakulix Drakulix changed the title Login failed with "{'Error': 'BadAuthentication'} Login failed with "{'Error': 'BadAuthentication'}" Nov 18, 2020
@arunoruto
Copy link
Contributor

arunoruto commented Dec 14, 2020

I am also unable to login with my apppassword and tried multiple things.
I tried the functions on my windows machine and the master token is retrieved so it seems like there is a problem with the system on the Pi.
Would it maybe be possible to add an additional field while setting it up? Optionally one can also provide a master token directly and skip the master token retrieval for now.

EDIT: I came up with a quick way of bypassing the problem. Maybe you find the pull request useful: #16

@Edo78
Copy link

Edo78 commented Jan 3, 2021

I'm having the same issue but it's not clear how to obtain the master token

@arunoruto
Copy link
Contributor

I'm having the same issue but it's not clear how to obtain the master token

Sorry, I totally neglected that part, since I was a bit familiar with that part from the past.
I was using this simple script to retrieve the master token: https://gist.github.com/rithvikvibhu/952f83ea656c6782fbd0f1645059055d
@Drakulix should I make a quick update to the readme or do you want to do it?

@Drakulix
Copy link
Owner

Drakulix commented Jan 3, 2021

I'm having the same issue but it's not clear how to obtain the master token

Sorry, I totally neglected that part, since I was a bit familiar with that part from the past.
I was using this simple script to retrieve the master token: https://gist.github.com/rithvikvibhu/952f83ea656c6782fbd0f1645059055d
@Drakulix should I make a quick update to the readme or do you want to do it?

Sure, make a PR for the readme, if you want, to explain the situation a bit better.
But the readme already links here anyway.

@QkulleQ
Copy link

QkulleQ commented Jan 3, 2021

Thanks, I have it working by retrieving a master token with this script! :D
However I had to do this to get gpsoauth installed:

apk add gcc
apk add libc-dev
pip install gpsoauth

Not sure if relevant, but here is my configuration:
Home Assistant Version: 2020.12.1
Installation Type: Home Assistant OS
Python Version: 3.8.6
Operating System Family: Linux
Operating System Version: 5.4.86
Host Operating System: Home Assistant OS 5.10
Supervisor Version: 2020.12.7
Docker Version: 19.03.13
Board: intel-nuc

@Drakulix
Copy link
Owner

Drakulix commented Jan 5, 2021

Since my authentication code and the linked script are almost identical, I suspect, that maybe the uuid.getnode-function (used to query the systems mac-address to generate a device id) might not yield a good result in some cases (or rather produces an ID, that is not accepted by google).

I noticed this, when I saw @QkulleQ is running Hassio, which means Home-Assistant is running in docker (where getnode would return a locally administered mac-address, that is very docker-specific).

Maybe @Edo78, @SoulEater45 and @djtimca could also post their setups? Primarily operating system and if they use any containerization?

Running the script on a different system (or not in a container) would in those cases result in another ID, which would explain, why the workaround with the script is generating a usable master_token, while the integration fails to do so automatically.
If that is indeed the case, I could try to come up with a different generation scheme to fix this.

@djtimca
Copy link
Author

djtimca commented Jan 5, 2021

I am running Supervised Docker on Ubuntu 20.04

@Edo78
Copy link

Edo78 commented Jan 5, 2021

I'm on a docker installation of HA Core

@arunoruto
Copy link
Contributor

I am running HassOS on a Raspberry Pi 4

@Drakulix
Copy link
Owner

Drakulix commented Jan 5, 2021

Alright, so we have only docker instances so far with this problem, which is a strong indication for my theory. I will try to work on an alternative authentication method / id generation. Maybe that will fix the problem. Be sure to subscribe to this issue, if you want to help with testing.

@cicero200272
Copy link

I am facing this issue as well and also run HA Core in Docker.

@Krojack
Copy link

Krojack commented Jan 26, 2021

I also got failed login when inputting my Google account UN and using a generated app password. I ended up having to use that script to get a Master Token. Because I was running the script from my Ubuntu server I had to install the app "Device ID" on my phone to get a device ID and also input that within the python script. Got the Master Token and put that in along with the username and app password. It worked.

@nvx
Copy link

nvx commented Feb 15, 2021

It looks like a new version of gpsoauth is out with some fixes that might help here. Latest seems to be 0.4.3, while 0.4.1 is in the manifest.

@Drakulix
Copy link
Owner

It looks like a new version of gpsoauth is out with some fixes that might help here. Latest seems to be 0.4.3, while 0.4.1 is in the manifest.

Thanks for the heads-up! Those are some good news, I will release a patch version with a bumped gpsoauth-version-requirement soon. Hopefully this issue will be solved then for good. (I will of course leave the workaround working until this is confirmed.)

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

8 participants