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 Drift: add OAuth 2.0 authentication option #7337

Merged
merged 14 commits into from
Nov 22, 2021

Conversation

bazarnov
Copy link
Collaborator

What

#6261 - Source Drift: support oauth

How

  • changed the authentication logic of client.py
  • changed spec.json
  • corrected unit_tests

Pre-merge Checklist

Expand the relevant checklist and delete the others.

Updating a connector

Community member or Airbyter

  • 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
    • 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

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

@github-actions github-actions bot added the area/connectors Connector related issues label Oct 25, 2021
@bazarnov bazarnov linked an issue Oct 25, 2021 that may be closed by this pull request
@bazarnov bazarnov self-assigned this Oct 25, 2021
@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Oct 25, 2021
@bazarnov bazarnov temporarily deployed to more-secrets October 25, 2021 18:25 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets October 28, 2021 11:12 Inactive
@bazarnov
Copy link
Collaborator Author

bazarnov commented Oct 28, 2021

/test connector=connectors/source-drift

🕑 connectors/source-drift https://github.com/airbytehq/airbyte/actions/runs/1394373636
✅ connectors/source-drift https://github.com/airbytehq/airbyte/actions/runs/1394373636
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                        74      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       18     11    39%
	 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                 47     20    57%
	 source_acceptance_test/utils/connector_runner.py        82     49    40%
	 source_acceptance_test/utils/json_schema_helper.py     115     14    88%
	 ------------------------------------------------------------------------
	 TOTAL                                                  860    419    51%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                              Stmts   Miss  Cover
	 -----------------------------------------------------
	 source_drift/__init__.py              3      0   100%
	 source_drift/client/__init__.py       3      0   100%
	 source_drift/client/api.py           97     28    71%
	 source_drift/client/client.py        33      4    88%
	 source_drift/client/common.py        56     27    52%
	 source_drift/client/fixture.py       24     24     0%
	 source_drift/source.py                4      0   100%
	 -----------------------------------------------------
	 TOTAL                               220     83    62%

@jrhizor jrhizor temporarily deployed to more-secrets October 28, 2021 11:31 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets November 1, 2021 09:54 Inactive
@yurii-bidiuk yurii-bidiuk linked an issue Nov 3, 2021 that may be closed by this pull request
@yurii-bidiuk yurii-bidiuk temporarily deployed to more-secrets November 3, 2021 12:44 Inactive
Copy link
Contributor

@alexandr-shegeda alexandr-shegeda left a comment

Choose a reason for hiding this comment

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

java part looks good

@bazarnov bazarnov temporarily deployed to more-secrets November 3, 2021 14:53 Inactive
@yurii-bidiuk
Copy link
Contributor

Hello @sherifnada
There is some issue with Drift authentication.
When we set up a new Drift source with OAuth2 authentication, we are redirected to the Drift authentication window
Screenshot from 2021-11-03 16-14-57
After clicking on 'Authorize App' we should be redirected back to Airbyte 'New connection' window and see that authentication succeeded. But instead of that, we get a CORS error:
Screenshot from 2021-11-03 16-00-53
Screenshot from 2021-11-03 16-01-08

When I disable CORS in my web browser, then I can pass the authentication scenario and get a success message:
Screenshot from 2021-11-03 16-02-36

Could you please advise something?

@bazarnov bazarnov temporarily deployed to more-secrets November 3, 2021 16:17 Inactive
@yurii-bidiuk yurii-bidiuk temporarily deployed to more-secrets November 3, 2021 16:27 Inactive
@sherifnada
Copy link
Contributor

@bazarnov to which domain is the erroneous request being made?

{
"type": "object",
"title": "OAuth2.0",
"required": ["client_id", "client_secret", "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.

access token is not required since we can use the other params to generate it

@yurii-bidiuk
Copy link
Contributor

@bazarnov to which domain is the erroneous request being made?

@sherifnada domain is customer2.api.drift.com
It fails on the case when we set redirect URL as localhost. When we set any other URL (eg https://dev-cloud.airbyte.io/auth_flow) then everything is going well and authentication is successful

@sherifnada
Copy link
Contributor

@yurii-bidiuk oops, tagged bazarnov by accident. It seems that local auth is the problem then. I think we should not block this PR on fixing localhost support. We should move ahead w this PR but also ask Drift support of there is any way to support localhost.

@bazarnov
Copy link
Collaborator Author

bazarnov commented Nov 4, 2021

They have the support of localhost, but it should be using https://... instead of http://...

@bazarnov
Copy link
Collaborator Author

@sherifnada can we plan to marge this PR? I think we passed all the tests at this point.

@bazarnov bazarnov temporarily deployed to more-secrets November 16, 2021 09:39 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets November 16, 2021 10:00 Inactive
@bazarnov
Copy link
Collaborator Author

bazarnov commented Nov 16, 2021

/test connector=connectors/source-drift

🕑 connectors/source-drift https://github.com/airbytehq/airbyte/actions/runs/1466482339
✅ connectors/source-drift https://github.com/airbytehq/airbyte/actions/runs/1466482339
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       38     27    29%
	 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                                                  896    440    51%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                              Stmts   Miss  Cover
	 -----------------------------------------------------
	 source_drift/__init__.py              3      0   100%
	 source_drift/client/__init__.py       3      0   100%
	 source_drift/client/api.py           97     28    71%
	 source_drift/client/client.py        33      4    88%
	 source_drift/client/common.py        56     27    52%
	 source_drift/client/fixture.py       24     24     0%
	 source_drift/source.py                4      0   100%
	 -----------------------------------------------------
	 TOTAL                               220     83    62%

@jrhizor jrhizor temporarily deployed to more-secrets November 16, 2021 10:55 Inactive
@bazarnov
Copy link
Collaborator Author

bazarnov commented Nov 16, 2021

/publish connector=connectors/source-drift

🕑 connectors/source-drift https://github.com/airbytehq/airbyte/actions/runs/1466516803
✅ connectors/source-drift https://github.com/airbytehq/airbyte/actions/runs/1466516803

@jrhizor jrhizor temporarily deployed to more-secrets November 16, 2021 11:04 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets November 16, 2021 11:14 Inactive
@yurii-bidiuk yurii-bidiuk temporarily deployed to more-secrets November 16, 2021 12:21 Inactive
@yurii-bidiuk yurii-bidiuk temporarily deployed to more-secrets November 18, 2021 12:34 Inactive
@yurii-bidiuk yurii-bidiuk temporarily deployed to more-secrets November 18, 2021 15:29 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets November 22, 2021 11:55 Inactive
@yurii-bidiuk yurii-bidiuk temporarily deployed to more-secrets November 22, 2021 14:08 Inactive
@bazarnov bazarnov merged commit c790a7f into master Nov 22, 2021
@bazarnov bazarnov deleted the bazarnov/6261-drift-oauth branch November 22, 2021 15:28
schlattk pushed a commit to schlattk/airbyte that referenced this pull request Jan 4, 2022
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 connectors/source/drift connectors/sources-api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source Drift: implement oauth2 java-part Source Drift: support oauth
7 participants