@@ -83,7 +83,19 @@ def get_client(
8383 base_url = os .environ .get ("ATLAN_BASE_URL" , "INTERNAL" )
8484 api_token = os .environ .get ("ATLAN_API_KEY" , "" )
8585 user_id = os .environ .get ("ATLAN_USER_ID" , impersonate_user_id )
86-
86+ oauth_client_id = os .environ .get ("ATLAN_OAUTH_CLIENT_ID" , "" )
87+ oauth_client_secret = os .environ .get ("ATLAN_OAUTH_CLIENT_SECRET" , "" )
88+
89+ if oauth_client_id and oauth_client_secret :
90+ LOGGER .info ("Using OAuth client credentials for authentication." )
91+ client = AtlanClient (
92+ base_url = base_url ,
93+ oauth_client_id = oauth_client_id ,
94+ oauth_client_secret = oauth_client_secret ,
95+ )
96+ if set_pkg_headers :
97+ client = set_package_headers (client )
98+ return client
8799 if api_token :
88100 LOGGER .info ("Using provided API token for authentication." )
89101 api_key = api_token
@@ -121,6 +133,19 @@ async def get_client_async(
121133 base_url = os .environ .get ("ATLAN_BASE_URL" , "INTERNAL" )
122134 api_token = os .environ .get ("ATLAN_API_KEY" , "" )
123135 user_id = os .environ .get ("ATLAN_USER_ID" , impersonate_user_id )
136+ oauth_client_id = os .environ .get ("ATLAN_OAUTH_CLIENT_ID" , "" )
137+ oauth_client_secret = os .environ .get ("ATLAN_OAUTH_CLIENT_SECRET" , "" )
138+
139+ if oauth_client_id and oauth_client_secret :
140+ LOGGER .info ("Using Async OAuth client credentials for authentication." )
141+ client = AsyncAtlanClient (
142+ base_url = base_url ,
143+ oauth_client_id = oauth_client_id ,
144+ oauth_client_secret = oauth_client_secret ,
145+ )
146+ if set_pkg_headers :
147+ client = set_package_headers (client )
148+ return client
124149
125150 if api_token :
126151 LOGGER .info ("Using provided API token for authentication." )
0 commit comments