{"id":5939,"library":"gcloud-rest-auth","title":"Google Cloud Rest Auth","description":"gcloud-rest-auth (part of the gcloud-aio project) provides asynchronous Python clients for Google Cloud Platform authentication. It leverages aiohttp for non-blocking I/O, offering an efficient way to interact with Google Cloud services in async applications. The current version is 5.4.4, with releases occurring as needed across its various sub-packages.","status":"active","version":"5.4.4","language":"en","source_language":"en","source_url":"https://github.com/talkiq/gcloud-aio","tags":["google cloud","authentication","async","aiohttp","gcp"],"install":[{"cmd":"pip install gcloud-rest-auth","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"Despite the PyPI package name `gcloud-rest-auth`, the correct import path is `gcloud_aio.auth`, as it's a sub-package within the `gcloud-aio` monorepo.","wrong":"from gcloud_rest_auth import AioAuth","symbol":"AioAuth","correct":"from gcloud_aio.auth import AioAuth"}],"quickstart":{"code":"import asyncio\nimport os\nfrom gcloud_aio.auth import AioAuth\n\nasync def main():\n    # AioAuth will automatically find credentials (e.g., from GOOGLE_APPLICATION_CREDENTIALS, gcloud CLI, metadata server)\n    # For local development, ensure GOOGLE_APPLICATION_CREDENTIALS or gcloud is configured.\n    # Example: export GOOGLE_APPLICATION_CREDENTIALS='/path/to/your/key.json'\n    async with AioAuth() as client:\n        try:\n            token = await client.get_access_token()\n            print(f\"Successfully obtained access token: {token[:20]}...\")\n            # You can now use this token for authenticated requests to Google Cloud APIs\n        except Exception as e:\n            print(f\"Failed to obtain access token: {e}\")\n            print(\"Please ensure your Google Cloud credentials are set up correctly.\")\n\nif __name__ == \"__main__\":\n    asyncio.run(main())","lang":"python","description":"This quickstart demonstrates how to initialize the `AioAuth` client and retrieve an access token. It automatically handles credential discovery. Remember to have your Google Cloud credentials configured (e.g., via `GOOGLE_APPLICATION_CREDENTIALS` environment variable or `gcloud` CLI)."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or a later version.","message":"Python 3.9 support was dropped in `gcloud-rest-auth` version 5.4.4. Projects running on Python 3.9 will need to upgrade to Python 3.10 or newer.","severity":"breaking","affected_versions":">=5.4.4"},{"fix":"Always use `from gcloud_aio.auth import AioAuth` for importing the authentication client.","message":"The PyPI package name `gcloud-rest-auth` does not directly map to the import path. The correct import is `from gcloud_aio.auth import AioAuth`, reflecting its structure within the `gcloud-aio` monorepo.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your project uses `asyncio` and is compatible with `aiohttp` for network operations when using this library.","message":"This library provides asynchronous clients built on `aiohttp`. If you are working in a synchronous application or using a different HTTP client library, `gcloud-rest-auth` might not be the right fit.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to version 5.4.4 or newer to ensure correct handling of `auto_decompress` and proper integration with `aiohttp.ClientSession` settings.","message":"Version 5.4.4 fixed an issue where `auto_decompress` settings might have been unexpectedly overwritten or behaved incorrectly when passed as `None`. Older versions might exhibit subtle issues related to HTTP content decompression.","severity":"gotcha","affected_versions":"<5.4.4"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}