glocaltokens
Tool to extract Google device local authentication tokens in Python
What it is and what it does
glocaltokens is a Python library that retrieves short-lived local authentication tokens for Google Home devices by exchanging Google account credentials with Google's servers. These tokens enable direct local-network communication with Google Home devices via their undocumented local API, bypassing the cloud.
The package handles the OAuth-like flow to obtain master tokens (valid for extended periods) and access tokens (valid 1 hour), then uses those to fetch device-specific local tokens (valid about 1 day). It includes device discovery via zeroconf and supports filtering by device model. The documentation emphasizes storing master tokens rather than credentials, and warns against frequent re-authentication to avoid account lockouts.
Use it for:
- Build local-network home automation that controls Google Home devices without cloud dependency
- Extract and cache device tokens for periodic refresh in a long-running home assistant daemon
- Discover Google Home devices on the network and retrieve their local API endpoints
- Integrate Google Home control into a custom smart-home system using the local API
- Monitor or control timers and alarms on Google Home devices via direct local calls
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Extracts local authentication tokens from Google Home devices by authenticating with Google servers, enabling direct local control of Google Home devices via their local API.
Yes, if you need local control of Google Home devices and are comfortable with the token refresh lifecycle. The package is actively maintained, has no known vulnerabilities, and uses a permissive MIT license. Install friction is low. Main gotchas: tokens expire daily, re-authentication is rate-limited by Google, and the local API is undocumented. Suitable for home automation and local-network integrations.
Install
glocaltokens on PyPI
pip
pip install glocaltokensuv
uv add glocaltokenspoetry
poetry add glocaltokensInstalling glocaltokens
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained as of 2026-08-03 with 60 repository stars. Depends on six runtime packages including grpcio and zeroconf for device discovery and authentication.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you include the license notice.
Quickstart
pip install glocaltokens
from glocaltokens.client import GLocalAuthenticationTokens
client = GLocalAuthenticationTokens(
username="your_google_email",
password="your_google_password"
)
master_token = client.get_master_token()
google_devices = client.get_google_devices_json()
Requires Python 3.9 or later. Google credentials must be provided; calling the authentication method too frequently may cause Google to disconnect associated Android devices.
Verify before relying
- Whether the package handles two-factor authentication or app passwords for Google accounts
- How token refresh is managed when the 1-day expiration window approaches
- Whether device discovery works reliably across different network configurations
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — ghome-foyer-api, gpsoauth, grpcio, requests, simplejson, zeroconf |
| Maintenance | actively maintained — 406 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 173,852/month — #10,297 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: glocaltokens-0.7.6-py3-none-any.whl
Keywords: Authentication, Google, Google Home, LocalAuthenticationTokens
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
gpsoauthImplements Google Play Services OAuth…
permissive · top 15,000 on PyPI
broadlinkA Python module and CLI for discovering,…
permissive · top 15,000 on PyPI
micloudLogs into Xiaomi cloud accounts and retrieves…
permissive · top 15,000 on PyPI
gkeepapigkeepapi is an unofficial client library for…
permissive · top 15,000 on PyPI
google-nest-sdmA Python library for interacting with Google…
permissive · top 15,000 on PyPI
ghome-foyer-apiProvides generated Protobuf stubs for the…
permissive · top 15,000 on PyPI
tinytuyaControls and monitors Tuya WiFi smart devices…
permissive · top 15,000 on PyPI
homeassistantHome Assistant is an open-source home…
permissive · top 5,000 on PyPI
pyhiveapiA Python library for controlling Hive smart…
permissive · top 15,000 on PyPI
fastapi-cloudauthIntegrates FastAPI applications with cloud…
permissive · top 15,000 on PyPI