databricks-cli/libs/auth
shreyas-goenka b81008e2f6
Clean host URL in the `auth login` command (#1879)
## Changes
The host URL for databricks workspaces includes the workspaceId by
default as a positional arg. Eg:
https://e2-dogfood.staging.cloud.databricks.com/?o=1234

Thus a user can't simply copy paste the URL today to the auth login
command. They'll see a runtime error:
```
➜  cli git:(main) ✗ databricks auth login --host https://e2-dogfood.staging.cloud.databricks.com/\?o\=xxx --profile new-dg
Error: oidc: fetch .well-known: failed to unmarshal response body: invalid character '<' looking for beginning of value. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log:
GET /login.html
...
```

## Tests
Unit tests and manually. Now auth login works even when the workspace_id
is included in the URL.
2024-11-05 15:29:27 +00:00
..
cache Improve token refresh flow (#1434) 2024-05-16 10:22:09 +00:00
callback.go Added `bricks auth login` and `bricks auth token` (#158) 2023-01-06 16:15:57 +01:00
oauth.go Clean host URL in the `auth login` command (#1879) 2024-11-05 15:29:27 +00:00
oauth_test.go Clean host URL in the `auth login` command (#1879) 2024-11-05 15:29:27 +00:00
page.tmpl Fix link to workspace after AWS OAuth login (#234) 2023-03-08 11:56:46 +01:00