Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Google Sheets: Support connecting via Oauth webflow #6255

Closed
sherifnada opened this issue Sep 19, 2021 · 1 comment · Fixed by #6354
Closed

Source Google Sheets: Support connecting via Oauth webflow #6255

sherifnada opened this issue Sep 19, 2021 · 1 comment · Fixed by #6354

Comments

@sherifnada
Copy link
Contributor

sherifnada commented Sep 19, 2021

Tell us about the problem you're trying to solve

With the release of Airbyte Cloud, we need to start supporting Oauth for this connector, since it's the recommended way of authenticating users into a SaaS application.

If this connector doesn't support oauth already (i.e: doesn't accept a client_id and client_secret) then we need to update its spec to accept those parameters. I suggest that this be a oneof nested inside a top-level field called "authentication":

{
  authentication: {
     type: object
     oneOf: [ 
       // api key,
       // oauth
     ] 
  }
}

See the connector spec reference in the docs for reference on how a oneof can be implemented.

This should be done in a backwards compatible manner i.e: users currently supplying authentication info in the config's top-level should not be impacted by this change.

Acceptance Criteria

  1. The connector supports oauth webflow authentication with client_id/client_secret
  2. Oauth properties are annotated properly. See this PR for an example
@sherifnada sherifnada added type/enhancement New feature or request area/oauth labels Sep 19, 2021
@sherifnada sherifnada added the area/connectors Connector related issues label Sep 20, 2021
@gaart gaart self-assigned this Sep 20, 2021
@gaart
Copy link
Contributor

gaart commented Sep 20, 2021

The task is to add the ability to authorize via oAuth.

Current implementation of the connector:

At the moment, google sheet is not implemented using CDK (HttpStream or something like that), but natively using Google libs to work with their services (the Source class from the CDK is used and all methods for the work with the sheet API are overridden there). Seems like it was done because tables are a quite unique data format comparing to many other connectors, and you can't come up with streams and endpoints. There is just a table and you need to download data by rows and columns from this table.

At the moment, there is authorization with service account only.

The necessary implementation steps:

  • change spec.json (add the required fields, and select the authorization method)
  • add functionality that supports oAuth using (refresh_token, client_id, client_secret) in the method below, just add a condition that checks which authorization method is selected and, depending on this, return Credentials tied to a specific authorization method
    @staticmethod
    def get_authenticated_google_credentials(credentials: Dict[str, str], scopes: List[str] = SCOPES):
        return service_account.Credentials.from_service_account_info(credentials, scopes=scopes)

DoD:

  • pass all tests for all types of authorization
  • correct display via UI
  • updated documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants