diff --git a/libs/auth/oauth.go b/libs/auth/oauth.go index e6b9e241..0c250d8c 100644 --- a/libs/auth/oauth.go +++ b/libs/auth/oauth.go @@ -46,9 +46,10 @@ const ( ) var ( // Databricks SDK API: `databricks OAuth is not` will be checked for presence - ErrOAuthNotSupported = errors.New("databricks OAuth is not supported for this host") - ErrNotConfigured = errors.New("databricks OAuth is not configured for this host") - ErrFetchCredentials = errors.New("cannot fetch credentials") + ErrOAuthNotSupported = errors.New("databricks OAuth is not supported for this host") + ErrNotConfigured = errors.New("databricks OAuth is not configured for this host") + ErrFetchCredentials = errors.New("cannot fetch credentials") + ErrDeviceCodeNotSupported = errors.New("device code flow is not supported for this host") ) type PersistentAuth struct { @@ -129,6 +130,9 @@ func (a *PersistentAuth) DeviceCode(ctx context.Context) error { if err != nil { return err } + if cfg.Endpoint.DeviceAuthURL == "" { + return ErrDeviceCodeNotSupported + } ctx = a.http.InContextForOAuth2(ctx) deviceAuthResp, err := cfg.DeviceAuth(ctx) if err != nil {