Skip to main content

Google Auth with Python, but easy

The easiest way to authenticate for the Google services.

This library is intented to simplify the interaction with the Google API for using the Google services such as Youtube, Slides, etc.

Instructions

  1. Go to the Google Developers console: https://console.cloud.google.com.
  2. Go to the APIs library (https://console.cloud.google.com/apis/library) and enable the one you need.
  3. Go to the Oauth Credentials section (https://console.cloud.google.com/apis/credentials) and create a new Oauth Authentication ID for a Desktop App. Remember to download it as a JSON file when created. *Maybe you need to create a Consent screen (enable as testing and add yourself as a tester or publish it) and create a new project in the console.
  4. Place the client-secret.json in the project.
  5. Indicate that client-secret.json and use the library. You will generate a token.json that will be used to consider you as an authenticated user.

Usage

from google_auth_easy import GoogleAuth
from google_auth_easy.config import GoogleAuthConfig
from google_auth_easy.scopes import Scope

# Indicate your client_secret file
config = GoogleAuthConfig(
    client_secret_file = 'client_secret.json',
)

# Initialize the instance
auth = GoogleAuth(config)

# Authenticate it for your desired scopes
auth.authenticate(
    Scope.DRIVE_READONLY,
)

Extra information

client_secret.json

Your client secret information must be a .json file that includes your client id, your client secret and some other fields. You can download this information from Google API web platform by creating your Oauth user. Here is an example:

{
    "web": {
    "client_id": "XXXXXXX.apps.googleusercontent.com",
    "client_secret": "XXXXXX",
    "redirect_uris": [],
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://accounts.google.com/o/oauth2/token"
    }
}

token.json

Your token must be a .json file that includes the information needed to authenticate your user, and some extra information such as if the token can be refreshed or not:

{
    "token": "ya29.a0ARGnu0ZyKzwSGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXwhXw0206",
    "refresh_token": "1//0g7tTXXXXXXXXXXXXXXXXXXXXXSNwF-L9Ir_hEj8XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX7le_X6XXXXXXXXXXXQ",
    "token_uri": "https://oauth2.googleapis.com/token",
    "client_id": "59591XXXXXXXXXXXXXXXXXXXXXXXg1ti.apps.googleusercontent.com",
    "client_secret": "GXXXXXX-3gDXXXXXXXXXXXXXXXXXXXXXJP",
    "scopes": ["https://www.googleapis.com/auth/drive.readonly"],
    "universe_domain": "googleapis.com",
    "account": "",
    "expiry": "2026-08-05T12:37:57Z"
}

Download files

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

Source Distribution

google_auth_easy-0.0.6.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_auth_easy-0.0.6-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file google_auth_easy-0.0.6.tar.gz.

File metadata

  • Download URL: google_auth_easy-0.0.6.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.9.0 Windows/10

File hashes

Hashes for google_auth_easy-0.0.6.tar.gz
Algorithm Hash digest
SHA256 f05b5a566a0bd8fb250bbe71704fb3c804a695755991ee09cf4b55f16068f244
MD5 41080c199ecdb79e4c782216e7010c58
BLAKE2b-256 155575410889757dc70df4f409c3575919279472ba5842c5dbb217e5003ed3fb

See more details on using hashes here.

File details

Details for the file google_auth_easy-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: google_auth_easy-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.9.0 Windows/10

File hashes

Hashes for google_auth_easy-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b59310bb2d91648d4596aa6e676813fcb04171a20e89f3e81b92e05b271b29ec
MD5 2f1fdc640df816a72b145f1a36f3b7f6
BLAKE2b-256 0b943472430caf637bbeec3ee727f6d0eed8f108092ba13d1d4623a0ed4be378

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page