Skip to content

Commit

Permalink
change api key name, use oauth first
Browse files Browse the repository at this point in the history
  • Loading branch information
keyn4 committed Apr 10, 2024
1 parent b369353 commit d3cf2df
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tap_klaviyo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ class KlaviyoStream(RESTStream):

@property
def authenticator(self):
# auth with hapikey
if self.config.get("api_key"):
api_key = f'Klaviyo-API-Key {self.config.get("api_key")}'
# auth with access token
if self.config.get("refresh_token"):
return KlaviyoAuthenticator.create_for_stream(self)
# auth with api key
elif self.config.get("api_private_key"):
api_key = f'Klaviyo-API-Key {self.config.get("api_private_key")}'
return APIKeyAuthenticator.create_for_stream(
self, key="Authorization", value=api_key, location="header"
)
# auth with acces token
return KlaviyoAuthenticator.create_for_stream(self)

@property
def http_headers(self) -> dict:
Expand Down

0 comments on commit d3cf2df

Please sign in to comment.