-
Notifications
You must be signed in to change notification settings - Fork 94
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
Bug in M2M authentication #423
Comments
Hi @jwhite3! I'm terribly sorry, somehow I missed this issue. You should adjust |
@jwhite3 Sorry, I misunderstood your issue. So, the example from the link you provided looks like this: from databricks.sdk.core import Config, oauth_service_principal
from databricks import sql
import os
server_hostname = os.getenv("DATABRICKS_SERVER_HOSTNAME")
def credential_provider():
config = Config(
host = f"https://{server_hostname}",
client_id = os.getenv("DATABRICKS_CLIENT_ID"),
client_secret = os.getenv("DATABRICKS_CLIENT_SECRET")
)
return oauth_service_principal(config) # <-- !!!
with sql.connect(server_hostname = server_hostname,
http_path = os.getenv("DATABRICKS_HTTP_PATH"),
credentials_provider = credential_provider) as connection: While it seems that there's a bug in from databricks.sdk.core import Config, oauth_service_principal
from databricks import sql
import os
server_hostname = os.getenv("DATABRICKS_SERVER_HOSTNAME")
def credential_provider():
config = Config(
host = f"https://{server_hostname}",
client_id = os.getenv("DATABRICKS_CLIENT_ID"),
client_secret = os.getenv("DATABRICKS_CLIENT_SECRET")
)
def get_headers():
return oauth_service_principal(config)
return get_headers
with sql.connect(server_hostname = server_hostname,
http_path = os.getenv("DATABRICKS_HTTP_PATH"),
credentials_provider = credential_provider) as connection: Indeed, we still have to fix this in docs, but at least not the library itself 🙂 |
(v3.3.0)
When attempting to follow the documentation for M2M authentication I get an error that after tons of digging seems to be the result of a bug.
Specifically, there's a bug in the
ExternalAuthProvider
class (which is used when attempting to authenticate via M2M following the instructions.If I had to guess, I would assume that either the
OAuthCredentialsProvider
should return a callable when called, or that assignment of the_header_factory
attribute should not be a call to the instance. Then the headers dict would be correctly generated inadd_headers
The text was updated successfully, but these errors were encountered: