This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.3.2 instead.
Reason given by maintainers: Broken release: unresolved merge conflict makes import fail. Use 0.3.2 or later.
google-auth-core
Single source of truth for the ~/.google credential store, shared by the
Google CLIs (gmail-cli, google-calendar-cli) and the Google Workspace MCP
servers (gmail-mcp, gcal-mcp, gsheets-mcp, gdocs-mcp, gdrive-mcp).
What it provides
- A unified per-account token store under
~/.google/tokens/google_<account>.jsonholding all scopes (Gmail + Calendar + Sheets + Docs + Drive + Contacts), so one consent covers every service for both CLIs and MCP servers. - Account management: default account, aliases (
work,personal), env and directory overrides. get_service(api, version, account): an authorizedgoogleapiclientservice, cached per(account, api, version)for persistent, multi-account-safe use.- A consistent error taxonomy (
AuthError,NotFoundError,RateLimitError,InvalidArgumentError,UpstreamError) andmap_http_error.
CLI
google-auth login [account] # one-time OAuth, writes a unified token
google-auth login --readonly you@work.com # read-only token, no writes possible
google-auth list # accounts, default, aliases
google-auth alias work you@work.com
google-auth status # token health per account
google-auth default you@work.com
google-auth logout you@work.com # revoke at Google, then delete locally
google-auth logout --local-only you@work.com # delete locally, skip revoke
Place your OAuth client (Desktop app) at ~/.google/credentials.json first.
google-auth setup walks you through creating one; google-auth doctor checks
an existing setup.
Avoid "Testing" status on the OAuth consent screen. Google expires refresh
tokens after 7 days for an External app left in Testing, so you'd have to re-run
google-auth login every week. Instead:
- Google Workspace account: set the user type to Internal. No test users, no warning screen, tokens don't expire weekly. The Cloud project must belong to your Workspace organization, and only its accounts can sign in.
- Personal Gmail, or accounts from several domains: use External, then click Publish app so the status is In production (no need to submit for verification). Each login shows an "unverified app" warning: click Advanced, then Go to (your app name) (unsafe). Google caps unverified apps at 100 users, which doesn't matter for personal use.
Already in Testing? Switch to In production and run google-auth login again
for each account.
Which feature needs which scope
| Feature | Full login | --readonly login |
|---|---|---|
| Gmail | gmail.readonly, gmail.send, gmail.modify, gmail.settings.basic |
gmail.readonly |
| Calendar | calendar |
calendar.readonly |
| Sheets | spreadsheets |
spreadsheets.readonly |
| Docs | documents |
documents.readonly |
| Drive | drive |
drive.readonly |
Contacts (search_contacts) |
contacts.readonly, contacts.other.readonly, directory.readonly |
same |
Each feature also needs its API enabled in your Cloud project (the People API
for Contacts); google-auth setup links to all of them.
Tokens from before Contacts existed keep working. They don't have its
scopes, but get_credentials and check_token_health still treat
them as healthy: the missing feature scopes are left out of the refresh
request (asking Google for scopes it never granted fails with
invalid_scope), so Gmail, Calendar, Sheets, Docs and Drive carry on. Only contact
search fails, with Google's insufficient-scope error. google-auth status
and google-auth doctor name what's missing:
you@work.com: valid
contacts not granted. Run: google-auth login you@work.com to grant contacts
The same applies if you untick the contacts boxes on Google's consent screen: the login still succeeds and the token records only what you granted.
In code, missing_features(granted_scopes) and
token_missing_features(account) return {feature: [missing scopes]}, empty
when everything is covered.
Read-only login
google-auth login --readonly requests only the read-only scopes in the
table above (gmail.readonly, calendar.readonly, spreadsheets.readonly,
documents.readonly, drive.readonly and the three contacts scopes). The token itself cannot send mail, edit events, or change or
delete files, whatever the MCP server or CLI tries. This is stronger than
GOOGLE_MCP_READONLY, which only hides write tools.
The granted scopes saved in the token file record which set it holds
(scope_set() returns full, readonly or partial). get_credentials and
check_token_health treat a read-only token as healthy even when called with
ALL_SCOPES, and status / doctor label it read-only. Writes fail with an
AuthError that says the account is read-only: call
require_write_access(account) before a write to fail early, or let the 403
from Google map to the same message. Run google-auth login <account> without
the flag to upgrade to full access.
Logout
google-auth logout revokes the refresh token at Google
(POST https://oauth2.googleapis.com/revoke) before deleting the local file, so
a copied token stops working too. A token Google already treats as invalid is
not an error. If Google cannot be reached, nothing is deleted; retry, or pass
--local-only.
Metadata
Release files for google-auth-core 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| google_auth_core-0.3.1.tar.gz | 35.2 kB | Without provenance | Details for google_auth_core-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| google_auth_core-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for google_auth_core-0.3.1-py3-none-any.whl |
Total release size: 65.2 kB
Release files / google_auth_core-0.3.1.tar.gz
| Download URL | google_auth_core-0.3.1.tar.gz |
|---|---|
| Size | 35.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f1331730d1d3ab3867cdd4ff4e5220187d1ad7fba9d2585944cff22e1763a9a
|
|
BLAKE2b-256 checksum How to use checksums |
c986eb9ab29433ece7c75bb59e9eacc5fb2f1ba4cb1369bfa6d5cfeeacf64d5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|
Release files / google_auth_core-0.3.1-py3-none-any.whl
| Download URL | google_auth_core-0.3.1-py3-none-any.whl |
|---|---|
| Size | 30.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76beda08c59f0a2b1aaefc598515728f3e5eaf31caf8679026835815c1750472
|
|
BLAKE2b-256 checksum How to use checksums |
6a64b9a6f020e4ba8aba17008999cd023985bc7db6f3eece090abcb806b9d63d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|
Security for google-auth-core 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.