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 Directory: support oauth #7409

Merged
merged 12 commits into from
Nov 5, 2021

Conversation

vitaliizazmic
Copy link
Contributor

What

Supporting oauth

How

Source Google Directory already supports authentication via Service account. So oauth webflow support was added. And specification was updated.

Closes #6265

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions
  • Connector version bumped like described here

@vitaliizazmic vitaliizazmic self-assigned this Oct 27, 2021
@github-actions github-actions bot added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels Oct 27, 2021
@vitaliizazmic
Copy link
Contributor Author

vitaliizazmic commented Oct 27, 2021

/test connector=source-google-directory

🕑 source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1390291596
❌ source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1390291596
🐛

@jrhizor jrhizor temporarily deployed to more-secrets October 27, 2021 13:20 Inactive
@vitaliizazmic
Copy link
Contributor Author

vitaliizazmic commented Oct 27, 2021

/test connector=source-google-directory

🕑 source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1390394479
❌ source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1390394479
🐛 https://gradle.com/s/e6iitkb22d532

@jrhizor jrhizor temporarily deployed to more-secrets October 27, 2021 13:46 Inactive
@@ -4,18 +4,97 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Google Directory Spec",
"type": "object",
"required": ["credentials_json", "email"],
"required": ["credentials"],
Copy link
Contributor

Choose a reason for hiding this comment

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

How would it work w/ old config format with email / credentials_json fields in the root? You need to remove required field and set additionalProperties to true if you want make it backward compatible.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can also use OneOf in the required field

"description": "The token for obtaining new access token",
"airbyte_secret": true
},
"scopes": {
Copy link
Contributor

Choose a reason for hiding this comment

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

you dont need scopes, just client_id, client_secret and refresh_token

"oauth2Specification": {
"rootObject": ["credentials", 0],
"oauthFlowInitParameters": [["client_id"], ["client_secret"]],
"oauthFlowOutputParameters": [["access_token"], ["refresh_token"]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove access_token

@vitaliizazmic vitaliizazmic temporarily deployed to more-secrets October 28, 2021 14:57 Inactive
@vitaliizazmic
Copy link
Contributor Author

vitaliizazmic commented Oct 28, 2021

/test connector=source-google-directory

🕑 source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1395184400
❌ source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1395184400
🐛 https://gradle.com/s/di46dm4yi72ve

@jrhizor jrhizor temporarily deployed to more-secrets October 28, 2021 15:03 Inactive
@vitaliizazmic vitaliizazmic temporarily deployed to more-secrets October 28, 2021 15:42 Inactive
@vitaliizazmic vitaliizazmic temporarily deployed to more-secrets October 28, 2021 17:39 Inactive
Copy link
Contributor

@sherifnada sherifnada left a comment

Choose a reason for hiding this comment

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

I didn't scrutinize the implementation, mostly looked at docs/UX. Do we need unit tests for auth?

@@ -37,7 +37,9 @@ This connector attempts to back off gracefully when it hits Directory API's rate

## Getting started

### Requirements
Google APIs use the OAuth 2.0 protocol for authentication and authorization. The Source supports [Web server application](https://developers.google.com/identity/protocols/oauth2#webserver) and [Service accounts](https://developers.google.com/identity/protocols/oauth2#serviceaccount) scenarios.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Google APIs use the OAuth 2.0 protocol for authentication and authorization. The Source supports [Web server application](https://developers.google.com/identity/protocols/oauth2#webserver) and [Service accounts](https://developers.google.com/identity/protocols/oauth2#serviceaccount) scenarios.
Google APIs use the OAuth 2.0 protocol for authentication and authorization. This connector supports [Web server application](https://developers.google.com/identity/protocols/oauth2#webserver) and [Service accounts](https://developers.google.com/identity/protocols/oauth2#serviceaccount) scenarios.

Can you also add a section explaining the difference in setup between OSS and Cloud? Similar to this one https://docs.airbyte.io/integrations/sources/google-analytics-v4#getting-started-airbyte-cloud

"type": "object",
"oneOf": [
{
"title": "Web server application",
Copy link
Contributor

Choose a reason for hiding this comment

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

making this suggestion because the non-technical personas explained in the UX handbook e.g: data analyst won't know what a "Web Server Application" means

Suggested change
"title": "Web server application",
"title": "Sign in via Google (Oauth)",

}
},
{
"title": "Service accounts",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"title": "Service accounts",
"title": "Service account Key",

@vitaliizazmic vitaliizazmic temporarily deployed to more-secrets October 29, 2021 14:03 Inactive
@keu keu changed the title 🎉 Source Google Direcotry: support oauth 🎉 Source Google Directory: support oauth Oct 29, 2021
@@ -82,6 +82,7 @@ write_standard_creds source-google-analytics-v4 "$GOOGLE_ANALYTICS_V4_TEST_CREDS
write_standard_creds source-google-analytics-v4 "$GOOGLE_ANALYTICS_V4_TEST_CREDS_SRV_ACC" "service_config.json"
write_standard_creds source-google-analytics-v4 "$GOOGLE_ANALYTICS_V4_TEST_CREDS_OLD" "old_config.json"
write_standard_creds source-google-directory "$GOOGLE_DIRECTORY_TEST_CREDS"
write_standard_creds source-google-directory "$GOOGLE_DIRECTORY_TEST_CREDS_OAUTH" "config_oauth.json"
Copy link
Contributor

Choose a reason for hiding this comment

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

does SAT use this config?
is there any tests for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@keu SAT isn't enabled in this source. I've created PR #7464. I will add required test there.

@vitaliizazmic vitaliizazmic temporarily deployed to more-secrets November 1, 2021 16:13 Inactive
# Conflicts:
#	airbyte-integrations/connectors/source-google-directory/source_google_directory/api.py
@vitaliizazmic vitaliizazmic temporarily deployed to more-secrets November 2, 2021 20:26 Inactive
@vitaliizazmic
Copy link
Contributor Author

vitaliizazmic commented Nov 3, 2021

/test connector=source-google-directory

🕑 source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1417313485
✅ source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1417313485
Python tests coverage:

	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                                 Stmts   Miss  Cover
	 ------------------------------------------------------------------------
	 source_acceptance_test/__init__.py                       2      0   100%
	 source_acceptance_test/base.py                          10      4    60%
	 source_acceptance_test/config.py                        75      8    89%
	 source_acceptance_test/conftest.py                     108    108     0%
	 source_acceptance_test/plugin.py                        47     47     0%
	 source_acceptance_test/tests/__init__.py                 4      0   100%
	 source_acceptance_test/tests/test_core.py              200     94    53%
	 source_acceptance_test/tests/test_full_refresh.py       33     22    33%
	 source_acceptance_test/tests/test_incremental.py        69     38    45%
	 source_acceptance_test/utils/__init__.py                 6      0   100%
	 source_acceptance_test/utils/asserts.py                 37      2    95%
	 source_acceptance_test/utils/common.py                  41     24    41%
	 source_acceptance_test/utils/compare.py                 62     25    60%
	 source_acceptance_test/utils/connector_runner.py        82     49    40%
	 source_acceptance_test/utils/json_schema_helper.py     115     14    88%
	 ------------------------------------------------------------------------
	 TOTAL                                                  891    435    51%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                  Stmts   Miss  Cover
	 ---------------------------------------------------------
	 source_google_directory/__init__.py       2      2     0%
	 source_google_directory/api.py           90     90     0%
	 Name                                  Stmts   Miss  Cover/actions-runner/_work/airbyte/airbyte/airbyte-integrations/connectors/source-google-directory/.venv/lib/python3.8/site-packages/coverage/control.py:761: CoverageWarning: No data was collected. (no-data-collected)
	 source_google_directory/client.py        26     26     0%
	   self._warn("No data was collected.", slug="no-data-collected")
	 source_google_directory/source.py         4      4     0%
	 source_google_directory/utils.py          3      3     0%
	 ---------------------------------------------------------
	 TOTAL                                   125    125     0%

@vitaliizazmic vitaliizazmic temporarily deployed to more-secrets November 3, 2021 15:01 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets November 3, 2021 15:02 Inactive
@vitaliizazmic
Copy link
Contributor Author

vitaliizazmic commented Nov 5, 2021

/publish connector=connectors/source-google-directory

🕑 connectors/source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1425621807
❌ connectors/source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1425621807

@vitaliizazmic vitaliizazmic temporarily deployed to more-secrets November 5, 2021 12:13 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets November 5, 2021 12:14 Inactive
@vitaliizazmic
Copy link
Contributor Author

vitaliizazmic commented Nov 5, 2021

/publish connector=connectors/source-google-directory

🕑 connectors/source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1425662807
❌ connectors/source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1425662807

@jrhizor jrhizor temporarily deployed to more-secrets November 5, 2021 12:27 Inactive
@vitaliizazmic vitaliizazmic temporarily deployed to more-secrets November 5, 2021 12:49 Inactive
@vitaliizazmic
Copy link
Contributor Author

vitaliizazmic commented Nov 5, 2021

/publish connector=connectors/source-google-directory

🕑 connectors/source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1426531755
✅ connectors/source-google-directory https://github.com/airbytehq/airbyte/actions/runs/1426531755

@vitaliizazmic vitaliizazmic temporarily deployed to more-secrets November 5, 2021 16:29 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets November 5, 2021 16:29 Inactive
@vitaliizazmic vitaliizazmic temporarily deployed to more-secrets November 5, 2021 16:41 Inactive
@vitaliizazmic vitaliizazmic merged commit 1f295f2 into master Nov 5, 2021
@vitaliizazmic vitaliizazmic deleted the vitalii/6265_google_direcotry_support_oauth branch November 5, 2021 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source Google Direcotry: support oauth
6 participants