Skip to content

Phase 1.2: Authentication commands (login, logout, whoami) #2

@omattsson

Description

@omattsson

Overview

Implement interactive login, logout, and credential management.

Tasks

  • stackctl login — prompt for username/password, call POST /api/v1/auth/login, store JWT
  • stackctl logout — clear stored token for current context
  • stackctl whoami — call GET /api/v1/auth/me, display user info
  • Token storage in ~/.stackmanager/tokens/<context>.json with expiry metadata (file perms 0600)
  • Auto-detect expired tokens; print clear error prompting re-login
  • API key auth via config set api-key sk_... — skips JWT when present

Acceptance Criteria

  • Full login/logout cycle works against make dev backend
  • stackctl whoami shows current user after login
  • API key auth works when configured
  • Expired token produces a clear error message

Depends On

API Endpoints

Method Path Description
POST /api/v1/auth/login { username, password }{ token }
GET /api/v1/auth/me Current user info

Metadata

Metadata

Assignees

No one assigned

    Labels

    authAuthentication and credentialsphase-1Phase 1: Foundation + Core Lifecycle (MVP)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions