Skip to content

Support Service Account Authentication#864

Open
Aurelian-Shuttleworth wants to merge 1 commit intoinsanum:mainfrom
Aurelian-Shuttleworth:feature/service-account
Open

Support Service Account Authentication#864
Aurelian-Shuttleworth wants to merge 1 commit intoinsanum:mainfrom
Aurelian-Shuttleworth:feature/service-account

Conversation

@Aurelian-Shuttleworth
Copy link
Copy Markdown

@Aurelian-Shuttleworth Aurelian-Shuttleworth commented Jan 25, 2026

What was done

  • Added --service-account <key-file> option to argparsers.py.
  • Implemented auth.load_service_account using google.oauth2.service_account.
  • Modified gcal.py to prioritize service account loading over user OAuth flows when the flag is present.
  • Added documentation to README.md.

Why

  • Headless Ops: Critical for server-side usage (CI/CD, backup scripts) where browser interaction is impossible.
  • Security: Enables usage of least-privilege service accounts scoped to specific resources.

Verification Steps

Automated Tests

Ran new unit tests in the hermetic Nix environment:

$ nix develop --command pytest tests/test_service_account.py
tests/test_service_account.py ..                                       [100%]
========================= 2 passed, 1 warning in 0.02s =========================

Manual Verification (End-to-End)

Verified against the live Google Calendar API using a real Service Account:

  1. Created a test Service Account via gcloud iam service-accounts create.
  2. Generated a JSON key file.
  3. Executed the list command:
    gcalcli --service-account key.json list
  4. Result: Successfully authenticated and listed calendars (e.g., 'EU Events') without any browser interaction.

@kody-ai
Copy link
Copy Markdown

kody-ai Bot commented Jan 25, 2026

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Automatic Review: Kody reviews this PR automatically on every push.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Cross File

Access your configuration settings here.

Comment thread gcalcli/gcal.py
Comment thread tests/conftest.py
@Aurelian-Shuttleworth Aurelian-Shuttleworth force-pushed the feature/service-account branch 2 times, most recently from 9be8bc4 to 99f5f79 Compare January 25, 2026 15:57
@ClimbTheWorld
Copy link
Copy Markdown

Hi there,
Thanks for implementing this feature @Aurelian-Shuttleworth .

When is this planned to be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants