1
0
mirror of synced 2025-12-21 19:11:14 -05:00
Files
airbyte/airbyte-integrations/connectors/source-salesloft/components.py
2024-12-18 14:05:43 -08:00

28 lines
860 B
Python

#
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#
from dataclasses import dataclass
from airbyte_cdk.sources.declarative.auth.oauth import DeclarativeSingleUseRefreshTokenOauth2Authenticator
from airbyte_cdk.sources.declarative.types import Config
@dataclass
class SingleUseOauth2Authenticator(DeclarativeSingleUseRefreshTokenOauth2Authenticator):
config: Config
def __post_init__(self):
self._connector_config = self.config
self._token_expiry_date_config_path = "credentials/token_expiry_date"
self.token_refresh_endpoint = "https://accounts.salesloft.com/oauth/token"
self._access_token_config_path = "credentials/access_token"
@property
def auth_header(self) -> str:
return "Authorization"
@property
def token(self) -> str:
return f"Bearer {self.get_access_token()}"