Skip to main content

Tool to extract Google device local authentication tokens in Python

Project description

Google home local authentication token extraction

Python 3 package to extract google home devices local authentication tokens from google servers. These local authentication tokens are needed to control Google Home devices(See @rithvikvibhu's Google Home (2.0) API).

Please note: Once you have local google authentication tokens they only live about 1 day long. After that you will need to obtain new ones. You will probably need to run the script repeatedly storing the tokens somewhere convenient.

Quickstart

Note: the package was written and tested on Python 3.

  • Install the python package
pip install glocaltokens

Use in your program as (see examples folder for detailed example):

from glocaltokens.client import GLocalAuthenticationTokens

# Using google username and password
client = GLocalAuthenticationTokens(
  username='<YOUR_GOOGLE_USERNAME>',
  password='<YOUR_GOOGLE_PASSWORD>'
)

# Get master token
print('[*] Master token', client.get_master_token())

# Get access token (lives 1 hour)
print('\n[*] Access token (lives 1 hour)', client.get_access_token())

# Get google device local authentication tokens (live about 1 day)
print('\n[*] Google devices local authentication tokens')
google_devices = client.get_google_devices_json()

Credits

Much credits go to @rithvikvibhu(https://github.com/rithvikvibhu) for doing most of the heavy work like finding a way to extract master and access tokens (See his gist here).

v0.1.2

* Removing dependency `requests==2.23.0` since `gpsoauth` is supporting newest versions

v0.1.1

* Fixing the GetHomeGraphResponse.Home.Device.State.value serialization issue

v0.1

* Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glocaltokens-0.1.3.tar.gz (19.1 kB view hashes)

Uploaded Source

Built Distribution

glocaltokens-0.1.3-py3-none-any.whl (20.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page