-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 Facebook-Marketing: Add Selectable Auth (with migration & tests) #38304
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
eccc2a1
EMRGE-1446 Selectable Auth working on local CLI. Still need to add ch…
JohnMikkelsonOvative cda978e
EMRGE-1446 Unit Tests for Selectable Auth all passing, 205 passed wit…
JohnMikkelsonOvative ccd385a
EMRGE-1446 Changed naming to reflect Facebook standard, updated sampl…
JohnMikkelsonOvative 4079845
Merge branch 'airbytehq:master' into JohnMikkelsonOvative/feature-fac…
JohnMikkelsonOvative 378f275
Merge remote-tracking branch 'origin/JohnMikkelsonOvative/feature-fac…
JohnMikkelsonOvative a5f4017
Merge branch 'master' into JohnMikkelsonOvative/feature-facebook-mark…
JohnMikkelsonOvative 7939c8a
Merge branch 'master' into JohnMikkelsonOvative/feature-facebook-mark…
marcosmarxm b60755a
merged from JohnMikkelsonOvative
dba3748
FB OAuth switch
f973e69
Merge branch 'master' into cmm-airbyte/fb_oauth
cmm-airbyte 040e234
fixing unit test
c55e538
pull from master
ec1ef32
Merge branch 'cmm-airbyte/fb_oauth' of https://github.com/airbytehq/a…
7aa761e
fixing formatting
e5f8341
modifying specs to test pass
e68dca4
Merge branch 'master' of https://github.com/airbytehq/airbyte into cm…
8331b49
applying feedback
864dc1a
Merge branch 'master' of https://github.com/airbytehq/airbyte into cm…
40285e0
pull from master
fca9c4c
fixes
f935fca
Merge branch 'master' into cmm-airbyte/fb_oauth
cmm-airbyte cc91553
Merge branch 'master' of https://github.com/airbytehq/airbyte into cm…
9f1b19f
Supporting credentials at both locations
ba309a6
Merge branch 'cmm-airbyte/fb_oauth' of https://github.com/airbytehq/a…
2476b72
Merge branch 'master' of https://github.com/airbytehq/airbyte into cm…
82683f8
Merge branch 'master' of https://github.com/airbytehq/airbyte into cm…
ff417dd
fixes spec
985d552
re-format test jsons
5380649
affinf auth type to spec
c6b0fed
removing auth type from root
5df66a9
Merge branch 'master' of https://github.com/airbytehq/airbyte into cm…
7e9451f
rm spec.json
c3addd1
merge from master
eb2498b
version bump
2a03f59
Merge branch 'master' of https://github.com/airbytehq/airbyte into cm…
7021679
adding back spec
8fdca53
fix format
c476c0a
Merge branch 'master' into cmm-airbyte/fb_oauth
cmm-airbyte eb8b13f
Merge branch 'master' of https://github.com/airbytehq/airbyte into cm…
543d5ea
merge from master and remove auth_type
709eb8d
Merge remote-tracking branch 'origin/master' into cmm-airbyte/fb_oauth
bazarnov ce31920
fixed failed CAT test
bazarnov 23e8a73
Merge branch 'master' into cmm-airbyte/fb_oauth
cmm-airbyte 1aa151d
Merge branch 'master' into cmm-airbyte/fb_oauth
cmm-airbyte 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
This file contains 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 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 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 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 |
---|---|---|
|
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",] | |
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry] | ||
version = "3.1.0" | ||
version = "3.2.0" | ||
name = "source-facebook-marketing" | ||
description = "Source implementation for Facebook Marketing." | ||
authors = [ "Airbyte <[email protected]>",] | ||
|
This file contains 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 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 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 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 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 |
---|---|---|
|
@@ -4,9 +4,10 @@ | |
import logging | ||
from datetime import datetime, timezone | ||
from enum import Enum | ||
from typing import List, Optional, Set | ||
from typing import List, Literal, Optional, Set, Union | ||
|
||
from airbyte_cdk.sources.config import BaseConfig | ||
from airbyte_cdk.utils.oneof_option_config import OneOfOptionConfig | ||
from facebook_business.adobjects.ad import Ad | ||
from facebook_business.adobjects.adset import AdSet | ||
from facebook_business.adobjects.adsinsights import AdsInsights | ||
|
@@ -31,6 +32,48 @@ | |
EMPTY_PATTERN = "^$" | ||
|
||
|
||
class OAuthCredentials(BaseModel): | ||
class Config(OneOfOptionConfig): | ||
title = "Authenticate via Facebook Marketing (Oauth)" | ||
discriminator = "auth_type" | ||
|
||
auth_type: Literal["Client"] = Field("Client", const=True) | ||
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. This probably needs an |
||
client_id: str = Field( | ||
title="Client ID", | ||
description="Client ID for the Facebook Marketing API", | ||
airbyte_secret=True, | ||
) | ||
client_secret: str = Field( | ||
title="Client Secret", | ||
description="Client Secret for the Facebook Marketing API", | ||
airbyte_secret=True, | ||
) | ||
access_token: Optional[str] = Field( | ||
title="Access Token", | ||
description="The value of the generated access token. " | ||
'From your App’s Dashboard, click on "Marketing API" then "Tools". ' | ||
'Select permissions <b>ads_management, ads_read, read_insights, business_management</b>. Then click on "Get token". ' | ||
'See the <a href="https://docs.airbyte.com/integrations/sources/facebook-marketing">docs</a> for more information.', | ||
airbyte_secret=True, | ||
) | ||
|
||
|
||
class ServiceAccountCredentials(BaseModel): | ||
class Config(OneOfOptionConfig): | ||
title = "Service Account Key Authentication" | ||
discriminator = "auth_type" | ||
|
||
auth_type: Literal["Service"] = Field("Service", const=True) | ||
access_token: str = Field( | ||
title="Access Token", | ||
description="The value of the generated access token. " | ||
'From your App’s Dashboard, click on "Marketing API" then "Tools". ' | ||
'Select permissions <b>ads_management, ads_read, read_insights, business_management</b>. Then click on "Get token". ' | ||
'See the <a href="https://docs.airbyte.com/integrations/sources/facebook-marketing">docs</a> for more information.', | ||
airbyte_secret=True, | ||
) | ||
|
||
|
||
class InsightConfig(BaseModel): | ||
"""Config for custom insights""" | ||
|
||
|
@@ -142,7 +185,7 @@ class Config: | |
min_items=1, | ||
) | ||
|
||
access_token: str = Field( | ||
access_token: Optional[str] = Field( | ||
title="Access Token", | ||
order=1, | ||
description=( | ||
|
@@ -154,6 +197,13 @@ class Config: | |
airbyte_secret=True, | ||
) | ||
|
||
credentials: Optional[Union[OAuthCredentials, ServiceAccountCredentials]] = Field( | ||
title="Authentication", | ||
description="Credentials for connecting to the Facebook Marketing API", | ||
discriminator="auth_type", | ||
type="object", | ||
) | ||
|
||
start_date: Optional[datetime] = Field( | ||
title="Start Date", | ||
order=2, | ||
|
This file contains 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.
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.
Set the type here so we can distinguish which type of authentication
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.
If
client_id
andclient_secret
are not defined, we should use the authService