Add vektor login command #5

Open
opened 2026-03-16 21:16:14 +00:00 by austin · 0 comments
Owner

Authenticate against a Vektor server from the command line and store the API token for subsequent commands.

What needs to happen

vektor login should:

  1. Prompt for email and password (read from stdin)
  2. Call POST /auth/login to authenticate
  3. Call POST /auth/token to get a long-lived API token
  4. Store the token in the config file
  5. Print a success message with the user's name

Also create a reusable API client struct in internal/cli/client.go that handles:

  • Base URL from config
  • Authorization: Bearer <token> header
  • JSON request encoding and response decoding
  • Error handling

All subsequent CLI commands will use this client.

Key files

  • cmd/vektor/main.go — add login subcommand
  • internal/cli/client.go — new, reusable HTTP client
  • internal/cli/config.go — read/write token
Authenticate against a Vektor server from the command line and store the API token for subsequent commands. ## What needs to happen `vektor login` should: 1. Prompt for email and password (read from stdin) 2. Call `POST /auth/login` to authenticate 3. Call `POST /auth/token` to get a long-lived API token 4. Store the token in the config file 5. Print a success message with the user's name Also create a reusable API client struct in `internal/cli/client.go` that handles: - Base URL from config - `Authorization: Bearer <token>` header - JSON request encoding and response decoding - Error handling All subsequent CLI commands will use this client. ## Key files - `cmd/vektor/main.go` — add login subcommand - `internal/cli/client.go` — new, reusable HTTP client - `internal/cli/config.go` — read/write token
austin added this to the CLI Core milestone 2026-03-16 21:16:14 +00:00
austin self-assigned this 2026-03-16 21:16:14 +00:00
austin added this to the Vektor - CLI project 2026-03-16 21:16:15 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
austin/vektor#5
No description provided.