Skip to content

Conversation

@zeroshade
Copy link
Member

When using dbc auth login to login to the Columnar private registry, we'll check the token and see if it contains the trial_start claim, downloading the license if it exists.

There's some more work that needs to happen here so I'm leaving this marked as WIP, such as:

  • Picking a domain for the cloudflare workers
  • making the worker domain configurable via env var
  • unit tests
  • verifying this workflow makes sense

@ianmcook
Copy link
Member

Nice! Let's also please make it so that if the user runs dbc install or dbc sync to install a private driver, dbc checks to see whether:

  1. the user is authenticated
  2. the user has an active trial license
  3. the user has not yet downloaded columnar.lic and put it in the required location.

If all three of those things are true, dbc should download columnar.lic and put it in the required location for the user.

@zeroshade zeroshade changed the title WIP: feat(auth): automatically fetch Columnar license on login feat(auth): automatically fetch Columnar license on login Dec 12, 2025
@zeroshade
Copy link
Member Author

@ianmcook updated per your suggestion

@zeroshade zeroshade requested a review from lidavidm December 12, 2025 21:25
@zeroshade
Copy link
Member Author

Added @lidavidm so he can see where dbc is putting the license

@ianmcook
Copy link
Member

@ianmcook updated per your suggestion

Nice! I tested it successfully.

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you log in and your trial is expired, you don't get any feedback:

$ dlv debug --headless ./cmd/dbc -- auth login
API server listening at: 127.0.0.1:39367
Opening https://auth.columnar.tech/activate?user_code=QVLR-GDCV in your default web browser...
Gtk-Message: 13:10:44.101: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
Authentication successful!

In dlv, I can see that I got a 403:

> github.com/columnar-tech/dbc/auth.FetchColumnarLicense() ./auth/credentials.go:318 (PC: 0x978c8a)
   313:		if err != nil {
   314:			return err
   315:		}
   316:		defer resp.Body.Close()
   317:	
=> 318:		if resp.StatusCode != http.StatusOK {
   319:			return fmt.Errorf("failed to fetch license: %s", resp.Status)
   320:		}
   321:	
   322:		licenseFile, err := os.OpenFile(licensePath, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0o600)
   323:		if err != nil {
(dlv) p resp.StatusCode
403

But this is not reported in the UI.

@amoeba
Copy link
Member

amoeba commented Dec 24, 2025

I'm not sure if this is the same error as @lidavidm got but here's what I did:

  1. Ran go run ./cmd/dbc auth login
  2. In my browser, saw the user code, clicked Confirm
  3. Logged in to Columnar with Google
  4. Got to my account details page (https://cloud.columnar.tech/account)

Back in my terminal, the CLI is stuck on

Authentication successful!
⠙ Waiting for confirmation...

I note that my trial is expired. Also I notice that the text says

Expires: Thu, 25 Dec 2025 23:16:09 GMT

but it should probably tell me that my license is expired.

Comment on lines +209 to +212
return nil
})
case nil:
return m, tea.Quit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looked fine to me but my auth command hung indefinitely. I think bubbletea doesn't like nil being used a signal.

Suggested change
return nil
})
case nil:
return m, tea.Quit
return tea.Quit()
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants