skillfed

glocaltokens

Tool to extract Google device local authentication tokens in Python

glocaltokens v0.7.6 173.9K downloads/30d#10,297 on PyPI60
Permissive license MIT Active released

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 glocaltokens

uv

uv add glocaltokens

poetry

poetry add glocaltokens

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.9Topic :: Software DevelopmentTyping :: Typed

Tags

google home local authenticationextract google device tokensgoogle home api tokenslocal google home controlgoogle device authenticationgoogle home device discoverygoogle home token management
home-automationgoogle-homelocal-api

More Software Development packages