-
Notifications
You must be signed in to change notification settings - Fork 5.1k
feat(source-google-calendar): add OAuth flow with credentials wrapper, config migration, and Service Account auth #76066
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
Open
Serhii Lazebnyi (lazebnyi)
wants to merge
7
commits into
master
Choose a base branch
from
slazebnyi/source-google-calendar-granular-scopes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4939986
feat(source-google-calendar): add oauth_connector_input_specification…
lazebnyi a73d45d
feat(source-google-calendar): replace placeholder icon with Google Ca…
lazebnyi 4191300
feat(source-google-calendar): restructure OAuth config with credentia…
devin-ai-integration[bot] ee79e2d
chore(source-google-calendar): bump version to 0.0.39
devin-ai-integration[bot] 89fc6ac
fix(source-google-calendar): consolidate duplicate changelog entries …
devin-ai-integration[bot] e81ea6b
feat(source-google-calendar): add Service Account auth type and Selec…
devin-ai-integration[bot] 09dd5da
Update docs/integrations/sources/google-calendar.md
lazebnyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 18 additions & 3 deletions
21
airbyte-integrations/connectors/source-google-calendar/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -156,17 +156,42 @@ definitions: | |
| type: InlineSchemaLoader | ||
| schema: | ||
| $ref: "#/schemas/events" | ||
| jwt_authenticator: | ||
| type: JwtAuthenticator | ||
| secret_key: "{{ json_loads(config['credentials']['service_account_info'])['private_key'] }}" | ||
| algorithm: "RS256" | ||
| token_duration: 3600 | ||
| jwt_payload: | ||
| aud: "{{ json_loads(config['credentials']['service_account_info'])['token_uri'] }}" | ||
| iss: "{{ json_loads(config['credentials']['service_account_info'])['client_email'] }}" | ||
| additional_jwt_payload: | ||
| scope: "https://www.googleapis.com/auth/calendar.readonly" | ||
| oauth_authenticator: | ||
| type: OAuthAuthenticator | ||
| refresh_request_body: {} | ||
| token_refresh_endpoint: https://oauth2.googleapis.com/token | ||
| grant_type: refresh_token | ||
| client_id: '{{ config["credentials"]["client_id"] }}' | ||
| client_secret: '{{ config["credentials"]["client_secret"] }}' | ||
| refresh_token: '{{ config["credentials"]["client_refresh_token_2"] }}' | ||
| jwt_profile_assertion_oauth_authenticator: | ||
| type: OAuthAuthenticator | ||
| token_refresh_endpoint: https://oauth2.googleapis.com/token | ||
| refresh_request_headers: | ||
| Content-Type: application/x-www-form-urlencoded | ||
| use_profile_assertion: true | ||
| profile_assertion: | ||
| $ref: "#/definitions/jwt_authenticator" | ||
| authenticator: | ||
| type: SelectiveAuthenticator | ||
| authenticator_selection_path: ["credentials", "auth_type"] | ||
| authenticators: | ||
| Client: "#/definitions/oauth_authenticator" | ||
| Service: "#/definitions/jwt_profile_assertion_oauth_authenticator" | ||
| base_requester: | ||
| type: HttpRequester | ||
| url_base: https://www.googleapis.com/calendar/v3/ | ||
| authenticator: | ||
| type: OAuthAuthenticator | ||
| client_id: "{{ config[\"client_id\"] }}" | ||
| grant_type: refresh_token | ||
| client_secret: "{{ config[\"client_secret\"] }}" | ||
| refresh_token: "{{ config[\"client_refresh_token_2\"] }}" | ||
| refresh_request_body: {} | ||
| token_refresh_endpoint: https://oauth2.googleapis.com/token | ||
| authenticator: "#/definitions/authenticator" | ||
|
|
||
| streams: | ||
| - $ref: "#/definitions/streams/colors" | ||
|
|
@@ -181,31 +206,143 @@ spec: | |
| type: object | ||
| $schema: http://json-schema.org/draft-07/schema# | ||
| required: | ||
| - client_id | ||
| - client_secret | ||
| - client_refresh_token_2 | ||
| - credentials | ||
| - calendarid | ||
| properties: | ||
| client_id: | ||
| type: string | ||
| credentials: | ||
| type: object | ||
| title: Authentication | ||
| description: >- | ||
| Credentials for connecting to the Google Calendar API | ||
| order: 0 | ||
| title: Client ID | ||
| airbyte_secret: true | ||
| client_secret: | ||
| type: string | ||
| order: 1 | ||
| title: Client secret | ||
| airbyte_secret: true | ||
| client_refresh_token_2: | ||
| type: string | ||
| order: 2 | ||
| title: Refresh token | ||
| airbyte_secret: true | ||
| oneOf: | ||
| - title: Authenticate via Google (OAuth) | ||
| type: object | ||
| required: | ||
| - auth_type | ||
| - client_id | ||
| - client_secret | ||
| - client_refresh_token_2 | ||
| properties: | ||
| auth_type: | ||
| type: string | ||
| const: Client | ||
| client_id: | ||
| title: Client ID | ||
| type: string | ||
| description: "Enter your Google application's Client ID. See <a href='https://developers.google.com/identity/protocols/oauth2'>Google's documentation</a> for more information." | ||
| airbyte_secret: true | ||
| client_secret: | ||
| title: Client Secret | ||
| type: string | ||
| description: "Enter your Google application's Client Secret. See <a href='https://developers.google.com/identity/protocols/oauth2'>Google's documentation</a> for more information." | ||
| airbyte_secret: true | ||
| client_refresh_token_2: | ||
| title: Refresh Token | ||
| type: string | ||
| description: "Enter your Google application's refresh token. See <a href='https://developers.google.com/identity/protocols/oauth2'>Google's documentation</a> for more information." | ||
| airbyte_secret: true | ||
| - title: Service Account Key Authentication | ||
| type: object | ||
| required: | ||
| - auth_type | ||
| - service_account_info | ||
| properties: | ||
| auth_type: | ||
| type: string | ||
| const: Service | ||
| service_account_info: | ||
| type: string | ||
| title: Service Account Information. | ||
| description: 'The JSON key of the service account to use for authorization. Read more <a href="https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating_service_account_keys">here</a>.' | ||
| airbyte_secret: true | ||
| examples: | ||
| - '{ "type": "service_account", "project_id": YOUR_PROJECT_ID, "private_key_id": YOUR_PRIVATE_KEY, ... }' | ||
| calendarid: | ||
| type: string | ||
| order: 3 | ||
| order: 1 | ||
| title: Calendar Id | ||
| additionalProperties: true | ||
| config_normalization_rules: | ||
| type: ConfigNormalizationRules | ||
| config_migrations: | ||
| - type: ConfigMigration | ||
| description: Migrate top-level OAuth fields into a nested credentials object. | ||
| transformations: | ||
| - type: ConfigAddFields | ||
| fields: | ||
| - type: AddedFieldDefinition | ||
| path: | ||
| - credentials | ||
| - auth_type | ||
| value: "Client" | ||
| - type: AddedFieldDefinition | ||
| path: | ||
| - credentials | ||
| - client_id | ||
| value: "{{ config['client_id'] }}" | ||
| - type: AddedFieldDefinition | ||
| path: | ||
| - credentials | ||
| - client_secret | ||
| value: "{{ config['client_secret'] }}" | ||
| - type: AddedFieldDefinition | ||
| path: | ||
| - credentials | ||
| - client_refresh_token_2 | ||
| value: "{{ config['client_refresh_token_2'] }}" | ||
| condition: "{{ config.get('client_id') is not none and config.get('credentials') is none }}" | ||
| - type: ConfigRemoveFields | ||
| field_pointers: | ||
| - - client_id | ||
| - - client_secret | ||
| - - client_refresh_token_2 | ||
|
Comment on lines
+295
to
+299
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these array of arrays?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, do we need to remove them? I like to think we could pin back if necessary. |
||
| condition: "{{ config.get('credentials') is not none }}" | ||
| advanced_auth: | ||
| auth_flow_type: oauth2.0 | ||
| predicate_key: | ||
| - credentials | ||
| - auth_type | ||
| predicate_value: Client | ||
| oauth_config_specification: | ||
| oauth_connector_input_specification: | ||
| scopes: | ||
| - scope: "https://www.googleapis.com/auth/calendar.readonly" | ||
| consent_url: "https://accounts.google.com/o/oauth2/v2/auth?{{client_id_param}}&{{redirect_uri_param}}&response_type=code&{{scopes_param}}&access_type=offline&{{state_param}}&include_granted_scopes=true&prompt=consent" | ||
| access_token_url: "https://oauth2.googleapis.com/token?{{client_id_param}}&{{client_secret_param}}&{{auth_code_param}}&{{redirect_uri_param}}&grant_type=authorization_code" | ||
| extract_output: | ||
| - refresh_token | ||
| complete_oauth_output_specification: | ||
| type: object | ||
| additionalProperties: false | ||
| properties: | ||
| refresh_token: | ||
| type: string | ||
| path_in_connector_config: | ||
| - credentials | ||
| - client_refresh_token_2 | ||
| complete_oauth_server_input_specification: | ||
| type: object | ||
| additionalProperties: false | ||
| properties: | ||
| client_id: | ||
| type: string | ||
| client_secret: | ||
| type: string | ||
| complete_oauth_server_output_specification: | ||
| type: object | ||
| additionalProperties: false | ||
| properties: | ||
| client_id: | ||
| type: string | ||
| path_in_connector_config: | ||
| - credentials | ||
| - client_id | ||
| client_secret: | ||
| type: string | ||
| path_in_connector_config: | ||
| - credentials | ||
| - client_secret | ||
|
|
||
| metadata: | ||
| autoImportSchema: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What the 2 means?