Skip to content

feat: Add GCP service account authentication support#103

Open
mporracindie wants to merge 7 commits into
singer-io:masterfrom
blueprint-data:master
Open

feat: Add GCP service account authentication support#103
mporracindie wants to merge 7 commits into
singer-io:masterfrom
blueprint-data:master

Conversation

@mporracindie

Copy link
Copy Markdown

Summary

  • Add optional service account authentication as an alternative to OAuth2 refresh token flow
  • Enable automated pipelines and CI/CD environments to use service accounts instead of user credentials
  • Maintain full backward compatibility with existing OAuth2 configurations

Changes

New Features

  • Support for service account authentication via file path (credentials_file)
  • Support for service account authentication via inline JSON (credentials_json) for CI/CD environments
  • Config validation to ensure mutual exclusivity between OAuth2 and service account credentials

Configuration Examples

Service account via file path:

  {                                                                                                                                                             
      "credentials_file": "/path/to/service-account-key.json",                                                                                                  
      "spreadsheet_id": "YOUR_SPREADSHEET_ID",                                                                                                                  
      "start_date": "2024-01-01T00:00:00Z",                                                                                                                     
      "user_agent": "tap-google-sheets <sa@project.iam.gserviceaccount.com>"                                                                                    
  }

Service account via inline JSON (for CI/CD):

{                                                                                                                                                             
    "credentials_json": "{\"type\": \"service_account\", ...}",                                                                                               
    "spreadsheet_id": "YOUR_SPREADSHEET_ID",                                                                                                                  
    "start_date": "2024-01-01T00:00:00Z",                                                                                                                     
    "user_agent": "tap-google-sheets <sa@project.iam.gserviceaccount.com>"                                                                                    
}

Validation Rules

  • Either OAuth2 credentials OR service account credentials required (not both)
  • For service accounts: either credentials_file OR credentials_json (not both)
  • Existing OAuth2 configs continue working unchanged

Test Plan

  • Unit tests pass (16 new tests)
  • Manual testing with real service account credentials
  • Discovery mode works with service account
    Sync mode extracts data correctly
  • Backward compatibility verified (OAuth2 still works)

AI generated code

https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code

  • this PR has been written with the help of GitHub Copilot or another generative AI tool

@matt-snider

Copy link
Copy Markdown

I'm not affiliated with this project. I just wanted to integrate Google Sheets with a service account so I was very happy to find this PR. I tested this locally with a service account and works for me as documented. Thank you!

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.

3 participants