Issue with Google OAuth and secret_id in Airbyte API

Summary

The user is experiencing a 422 error when attempting to create a source using Google OAuth credentials and a secret_id. The current request structure is incomplete according to the API’s json schema, missing required properties such as client_id, client_secret, and refresh_token. The user seeks clarification on how to properly utilize secret_id and if there is a process for obtaining full credentials from a secret_id.


Question

Hello everyone ,
I’m using Google OAuth to authenticate a source (Google Analytics, Google Sheets, BigQuery) via the Airbyte API. When I initiate OAuth, I go through the consent flow, which works correctly, and I receive a valid secret_id after the user provides consent.
When I try to create a source with the credential object and secretId at the top level, using the following structure :

  ...,
  "credentials": {
    "auth_type": "Client"
  },
  "secretId": "your_secret_id_here"
}```
I encounter the following error:
```{
  "status": 422,
  "type": "<https://reference.airbyte.com/reference/errors#unprocessable-entity>",
  "title": "unprocessable-entity",
  "detail": "The body of the request was not understood",
  "documentationUrl": null,
  "data": {
    "message": "json schema validation failed when comparing the data to the json schema. \nErrors: $.credentials: must be valid to one and only one schema, but 0 are valid, $.credentials: required property 'client_id' not found, $.credentials: required property 'client_secret' not found, $.credentials: required property 'refresh_token' not found, $.credentials.auth_type: must be the constant value 'Service', $.credentials: required property 'credentials_json' not found"
  }
}```
The API expects `client_id`, `client_secret`, or `refresh_token` when using the `secret_id`.

I also tried creating a source by removing the credential object `"auth_type": "Client"`, which resulted in an unauthenticated source :
```{
  ...,
  "secretId": "your_secret_id_here"
}```
Is there a process for exchanging a `secret_id` for the full credentials JSON? Or has anyone worked with `secret_id` before?

The documentation on this process isn’t very clear.

If I’m following the wrong steps, please help guide me.

Any assistance would be greatly appreciated.
Thank you!

<br>

---

This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. [Click here](https://airbytehq.slack.com/archives/C027KKE4BCZ/p1734005726881579) if you want
to access the original thread.

[Join the conversation on Slack](https://slack.airbyte.com)

<sub>
['google-oauth', 'api-error', 'secret-id', 'credentials-json', 'json-schema-validation']
</sub>