lquerel / gcp-bigquery-client

GCP BigQuery Client (Rust)
Apache License 2.0
97 stars 64 forks source link

Support all common GCP authentication flows #23

Open lquerel opened 2 years ago

lquerel commented 2 years ago

See https://github.com/lquerel/gcp-bigquery-client/discussions/21 for more details.

nozdrenkov commented 7 months ago

Loving your library! Thank you so much for working on it! Is there a way to authenticate using Bearer token somehow?

Unfortunately, I can't use service account keys for the project.. It should be fairly simple (just need to pass extra header -H "Authorization: Bearer [TOKEN]":

 curl -X POST \
  -H "Authorization: Bearer [TOKEN]" \
  -H "Content-Type: application/json" \
  --data '{
    "query": "SELECT 42"
  }' \
  "https://bigquery.googleapis.com/bigquery/v2/projects/[PROJECT_ID]/queries"

Where the token could be generated with e.g. $ gcloud auth application-default print-access-token. At the moment even without rotating tokens works well for me, etc.

Is there a way of doing it somehow? Thank you!