Skip to content

Commit

Permalink
Fixed OAuth M2M corner case in WorkspaceClient where `DATABRICKS_AC…
Browse files Browse the repository at this point in the history
…COUNT_ID` is present in the environment (#273)

## Changes

Also check for account client configuration when resolving OIDC
endpoints. Now logic is the same as in Go SDK:
https://github.com/databricks/databricks-sdk-go/blame/dd2802a246d8a2ac0689031cc93e15d97b486df8/config/auth_m2m.go#L45-L56

## Tests

Tested on a local change

Signed-off-by: Serge Smertin <259697+nfx@users.noreply.github.com>
  • Loading branch information
nfx authored Aug 8, 2023
1 parent 9dc991c commit b82fa01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion databricks/sdk/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ def oidc_endpoints(self) -> Optional[OidcEndpoints]:
return None
return OidcEndpoints(authorization_endpoint=real_auth_url,
token_endpoint=real_auth_url.replace('/authorize', '/token'))
if self.account_id:
if self.is_account_client and self.account_id:
prefix = f'{self.host}/oidc/accounts/{self.account_id}'
return OidcEndpoints(authorization_endpoint=f'{prefix}/v1/authorize',
token_endpoint=f'{prefix}/v1/token')
Expand Down

0 comments on commit b82fa01

Please sign in to comment.