<@U04S8PLJWMT> hey, i am running airbyte oss versi...
# replication-ask-ai
h
@kapa.ai hey, i am running airbyte oss version 1.8.3 . I am trying to add an oauth flow to the google sheet source. How can i do it ?
k
Setting Up OAuth for Google Sheets Source in Airbyte OSS 1.8.3 Yes, OAuth is supported for the Google Sheets source connector in Airbyte Open Source. Here's how to set it up: Step 1: Create a Google OAuth Application 1. Go to the Google Cloud Console and create a new OAuth client ID (select Web application). 2. Add
https://developers.google.com/oauthplayground
as an Authorized redirect URI. 3. Note your Client ID and Client Secret. 4. Enable the Google Sheets API in your GCP project. Step 2: Obtain a Refresh Token 1. Go to Google OAuth Playground. 2. Click the cog icon (top-right), select Use your own OAuth credentials, and enter your Client ID and Client Secret. 3. In the left sidebar, find Google Sheets API v4 and select the scope: ◦
https://www.googleapis.com/auth/spreadsheets.readonly
◦ Also add
https://www.googleapis.com/auth/drive.readonly
1. Click Authorize APIs, then in Step 2 click Exchange authorization code for tokens. 2. Note the Refresh Token. Step 3: Configure the Connector in Airbyte 1. Navigate to your Airbyte OSS dashboard. 2. Click Sources → + New source → select Google Sheets. 3. Enter a name for the connector. 4. From the Authentication dropdown, select Authenticate via Google (OAuth). 5. Enter your Client ID, Client Secret, and Refresh Token. 6. Paste your Spreadsheet Link. 7. Click Set up source. [Google Sheets Source Docs] [OAuth in Self-Managed] > Note: In Self-Managed Airbyte, you must configure your own client credentials — Airbyte does not manage the OAuth app for you (unlike Airbyte Cloud). [OAuth in Self-Managed] 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
h
@kapa.ai no , i want to add google oauth button. in airbyte ui we have to add client secret and client id. I don't want that. i want to add it once and then it should work with all workspaces. no manual adding of adding clinetid and client secret.
k
The knowledge sources do mention a way to set OAuth override credentials at the workspace level via the Airbyte API, which gets you closer to what you want — but I want to be transparent about the limitations. Setting Workspace-Level OAuth Credentials via API You can use the Airbyte Public API to set OAuth credentials once per workspace, so users in that workspace don't need to manually enter Client ID and Client Secret:
Copy code
PUT /workspaces/{workspaceId}/oauthCredentials
Request body example:
Copy code
{
  "actorType": "source",
  "name": "google-sheets",
  "configuration": {
    "credentials": {
      "client_id": "your-client-id",
      "client_secret": "your-client-secret"
    }
  }
}
This creates/updates OAuth credentials at the workspace level, overriding the need for users to enter them manually. [Airbyte Public API] Important Limitations However, the knowledge sources do not explicitly confirm that: 1. This API endpoint works across all workspaces in a single call — it appears to be per workspace, meaning you'd need to call it for each workspace separately. 2. This fully enables a one-click OAuth button experience in Airbyte OSS the same way Airbyte Cloud provides it. The knowledge sources indicate that the seamless "click to authenticate" OAuth button experience (where Airbyte manages the OAuth app) is primarily a Cloud feature. In Self-Managed Airbyte, you are responsible for managing client credentials. [OAuth in Airbyte] For a definitive answer on enabling this across all workspaces in OSS 1.8.3, I'd recommend checking the Airbyte community forum or opening a GitHub issue, as this may be a known limitation. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
h
so we use oss airbyte apis in our product. we call the apis to add soruce, connections etc. and we are multi org product, so each org = each workspace. now i want somehow i should add clientid and client secret and then users just have to do click on oauth button and it works right. how this can be done. one solution is to do everyhting ourside and then fill the config form structure and hit api or let airbyte handle the token exchange . @kapa.ai
k
Great context! Based on your setup (multi-org product, each org = one Airbyte workspace, using Airbyte OSS APIs), here are the two viable approaches the knowledge sources support: Option 1: Let Airbyte Handle the OAuth Flow (Recommended) This is the cleaner approach. You: 1. Register your OAuth credentials once per workspace (when a new org/workspace is created), by calling:
Copy code
curl -X PUT "https://<your-airbyte>/api/v1/workspaces/{workspaceId}/oauthCredentials" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "actorType": "source",
    "name": "google-sheets",
    "configuration": {
      "client_id": "YOUR_CLIENT_ID",
      "client_secret": "YOUR_CLIENT_SECRET"
    }
  }'
[Workspace OAuth Credentials API] 2. Initiate the OAuth flow for the user by calling:
Copy code
POST /sources/initiateOAuth
{
  "sourceType": "google-sheets",
  "workspaceId": "<workspace-id>",
  "redirectUrl": "https://your-app.com/oauth/callback"
}
This returns a
redirect_url
. You redirect your user to it, they click Authorize on Google's consent screen, and Airbyte handles the token exchange. The resulting secret ID is passed back to your
redirectUrl
as a
secret_id
query parameter. [Initiate OAuth API] 3. Create the source using the returned
secret_id
in place of actual tokens. Flow Summary
Copy code
Your backend: PUT oauthCredentials (once per workspace, at org creation time)
         ↓
Your backend: POST initiateOAuth → get redirect_url
         ↓
User: clicks OAuth button → redirected to Google consent screen
         ↓
Airbyte: handles token exchange → returns secret_id to your redirectUrl
         ↓
Your backend: POST /sources with secret_id
Option 2: Handle OAuth Externally, Fill Config Manually You handle the entire OAuth flow outside Airbyte (get access token + refresh token yourself), then pass the credentials directly when creating the source via the API. This works but means you're managing token refresh yourself, which is more maintenance burden. Key Limitation to Be Aware Of The workspace-level OAuth override is per workspace — so you'll need to call
PUT /workspaces/{workspaceId}/oauthCredentials
for each new workspace/org you create. A good pattern is to automate this as part of your org provisioning flow. [Workspace OAuth Credentials API] Also note: if multiple connections of the same source type exist in one workspace, OAuth credentials are currently scoped at the workspace level, meaning they're shared across all connections of that type in the workspace. [GitHub Discussion] Option 1 is the recommended path — it lets Airbyte handle token exchange securely while your users only see a simple OAuth button click. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.