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

Getting Logged out of my Google Account #8

Closed
ArnyminerZ opened this issue Feb 7, 2021 · 7 comments
Closed

Getting Logged out of my Google Account #8

ArnyminerZ opened this issue Feb 7, 2021 · 7 comments

Comments

@ArnyminerZ
Copy link
Collaborator

Describe the bug
When I use the script, when it's executed I get logged out of the Google Account of my Android phone.

To Reproduce
I have developed an script for Home Assistant that loads the alarms from my Lenovo Smart Clock, and loads them. When I use the script with the following sensor configuration:

  - platform: command_line
    command: /home/homeassistant/clock.sh
    name: alarms
    scan_interval: 30
    json_attributes:
      - alarm
      - timer
    value_template: "{{ value_json.alarm[0] }}"

when it gets executed, my Google Account at my Android Phone gets bugged, and asks me to log in again, blocking the use of any Google App at my device until I log in again.

Expected behavior
I should not get logged out.

Server:

  • OS: Raspbian OS
  • Version: Linux emonpi 5.10.11-v8+ #1399 SMP PREEMPT Thu Jan 28 12:14:03 GMT 2021 aarch64 GNU/Linux
  • Platform: Home Assistant (2021.2.0)
  • Python Version: 3.8.7

Smartphone (please complete the following information):

  • Device: Google Pixel 3a
  • OS: Android
  • Version: 11 (RQ1A.210205.004)

Additional context
I'm using an app password instead of my Google's Account password.

@ArnyminerZ
Copy link
Collaborator Author

Stopped happening with some of my own code modifications. Not sure of what could be the problem, but closing... I guess

@DurgNomis-drol
Copy link
Collaborator

I have been experiencing the same type of bug. Pi hole were the problem for me. Some of the libraries that this and other python based scripts/integration/packages rely on. One of these libraries have a problem with authenticating with google servers correctly. It is as of now a problem on googles servers, but a solution have been made to fix it(until google them self fixes there problem), but not all projects have the updated dependency yet. see Here

Weird problems happen on google's side when a connection fails. That is my experience with it anyway.

Hope this help's you if your problem persists.

Simon

@leikoilja
Copy link
Owner

Thanks, Simon(@DurgNomis-drol).

@ArnyminerZ, feel free to open PR if some of your code modifications might be helpful for the others

@ArnyminerZ
Copy link
Collaborator Author

Nevermind, my problem wasn't fixed. I think that the error occurs when you try to fetch the master token, but if you store it, it won't log me out.
More testing is required to confirm.

@DurgNomis-drol
Copy link
Collaborator

I am having the same problem, and is also trying to fix it right now. I have also suspected it was some thing to do with fetching the master token, but glad i m not only one who have come to that conclusion. Please share you're findings, i will do the same

@DurgNomis-drol
Copy link
Collaborator

I think i have found out how to solve the problem. You should only initialize this once, and then call get_google_devices_json() as often as you want to update/get timers or alarms.

client = GLocalAuthenticationTokens( username='<YOUR_GOOGLE_USERNAME>', password='<YOUR_GOOGLE_PASSWORD>' )

Your code modifications only works if your initialize this one time. Else you will still be hammering google services and it doesnt like that. Thats why you get disconnected(Me too) constantly.

@leikoilja
Copy link
Owner

Great find, @DurgNomis-drol!
We should make sure we have that logic in ha-glocaltokens to avoid disconnection and spamming google services with constant re-authentication

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

3 participants