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

add google sheets oauth flow to server + fix auth rootObject type in protocol #7131

Merged
merged 11 commits into from Oct 21, 2021

Conversation

Phlair
Copy link
Contributor

@Phlair Phlair commented Oct 18, 2021

What

starting point for: #7038

Confirmed Sheets, Ads and Search Console OAuth flow all working locally, ready to deploy and record demo videos.

Also, in protocol, updated type of OAuth2Specification.rootObject to array of [string or integer] to accurately reflect holding string keys and/or array index.

Note

purposely avoided DRYing tests as it could be made redundant by work that gets done next in this issue

@Phlair Phlair marked this pull request as draft October 18, 2021 18:07
@Phlair Phlair temporarily deployed to more-secrets October 18, 2021 22:37 Inactive
public class GoogleSheetsOAuthFlow extends GoogleOAuthFlow {

@VisibleForTesting
static final String SCOPE_URL = "https://www.googleapis.com/auth/spreadsheets.readonly";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the scopes also include Gdrive readonly like listed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left out Gdrive because get_authenticated_drive_client() is never actually used but I'll add it in for completeness.

@@ -227,7 +227,7 @@ definitions:
"
type: array
items:
type: string
type: [string, integer]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will require also CDK models and releasing a version of the CDK, also updating the API interface since it returns the same struct, and testing inserting the conversion between the two in the tests for this class

Copy link
Contributor Author

@Phlair Phlair Oct 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha. I believe this is a correct change and therefore worth the additional changes, sheets connector is hitting jsonvalidationerror on get spec otherwise, understandably because of the index integer in this array.
I'm not entirely sure why other connectors with an integer aren't already failing though... 🤷
Thanks for highlighting required changes!

assertTrue(credentials.get("access_token").toString().length() > 0);
}

static class ServerHandler implements HttpHandler {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to DRY this component? feels like we use it in every test class

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes all oauth backends are going to copy/paste this test structure, maybe worth DRYing it and making it easier for #4982

Copy link
Contributor Author

@Phlair Phlair Oct 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I think there's a lot of DRY to be had on the testing but thought I'd avoid until #4982 was clear in case the effort would be made redundant. If these will likely exist as is regardless then I'll DRY as part of this PR.

@Phlair Phlair temporarily deployed to more-secrets October 19, 2021 10:56 Inactive
# Conflicts:
#	airbyte-oauth/src/main/java/io/airbyte/oauth/OAuthImplementationFactory.java
@Phlair Phlair temporarily deployed to more-secrets October 21, 2021 13:40 Inactive
@github-actions github-actions bot added the CDK Connector Development Kit label Oct 21, 2021
@Phlair Phlair temporarily deployed to more-secrets October 21, 2021 14:03 Inactive
@github-actions github-actions bot added area/api Related to the api area/documentation Improvements or additions to documentation labels Oct 21, 2021
@Phlair Phlair marked this pull request as ready for review October 21, 2021 15:53
@github-actions github-actions bot added the area/connectors Connector related issues label Oct 21, 2021
@Phlair Phlair changed the title add google sheets oauth flow to server add google sheets oauth flow to server + fix auth rootObject type in protocol Oct 21, 2021
@Phlair Phlair temporarily deployed to more-secrets October 21, 2021 15:55 Inactive
@Phlair
Copy link
Contributor Author

Phlair commented Oct 21, 2021

/publish-cdk dry-run=true

🕑 https://github.com/airbytehq/airbyte/actions/runs/1368679419
https://github.com/airbytehq/airbyte/actions/runs/1368679419

@Phlair
Copy link
Contributor Author

Phlair commented Oct 21, 2021

/publish-cdk dry-run=false

🕑 https://github.com/airbytehq/airbyte/actions/runs/1368780406
https://github.com/airbytehq/airbyte/actions/runs/1368780406

@Phlair Phlair temporarily deployed to more-secrets October 21, 2021 16:41 Inactive
@Phlair
Copy link
Contributor Author

Phlair commented Oct 21, 2021

Merging this and will create a separate PR for bumping OSS Airbyte version

@Phlair Phlair merged commit d660661 into master Oct 21, 2021
@Phlair Phlair deleted the george/google-oauth branch October 21, 2021 17:28
schlattk pushed a commit to schlattk/airbyte that referenced this pull request Jan 4, 2022
…protocol (airbytehq#7131)

* adding google sheets oauth flow to server

* fix oauth type in protocol yaml

* bump sheets version in definitions

* added GDrive scope

* update sheets to master changes

* update protocol incl. cdk

* protocol typing for oauth rootobject

* format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Related to the api area/connectors Connector related issues area/documentation Improvements or additions to documentation area/protocol CDK Connector Development Kit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants