terraform-provider-airbyte icon indicating copy to clipboard operation
terraform-provider-airbyte copied to clipboard

Unable to make credentials work for airbyte_destination_google_sheets terraform module

Open anurag-sequoia opened this issue 1 year ago • 0 comments

As per https://registry.terraform.io/providers/airbytehq/airbyte/latest/docs/resources/destination_google_sheets#configuration, the configuration requires a client_id, a client_secret and a refresh_token to work. I have tried using a desktop-app client-id (and secret and refresh token) as well as a web-app credentials but neither of them work. Note: for the desktop-app (ie installed app), I obtained the refresh-token programatically; for web-app I took it from oauth-playground (https://developers.google.com/oauthplayground).

from google_auth_oauthlib.flow import InstalledAppFlow

SCOPES = ['https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/spreadsheets']

flow = InstalledAppFlow.from_client_config(
    {
      "installed":{
        "client_id": <>,
        "auth_uri":"https://accounts.google.com/o/oauth2/auth",
        "token_uri":"https://oauth2.googleapis.com/token",
        "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
        "client_secret": <>,
        }}, SCOPES)
creds = flow.run_local_server(port=0)
print(creds.refresh_token)

The airbyte destination works fine once I 'reauthenticate' from the UI manually.

anurag-sequoia avatar Feb 23 '24 08:02 anurag-sequoia