Skip to content

feat(auth): add support for user-based auth, public-api-server - #902

Open
rektdeckard wants to merge 16 commits into
mainfrom
tobiasfried/devx-577-implement-dual-mode-auth-routing-in-the-cli
Open

feat(auth): add support for user-based auth, public-api-server#902
rektdeckard wants to merge 16 commits into
mainfrom
tobiasfried/devx-577-implement-dual-mode-auth-routing-in-the-cli

Conversation

@rektdeckard

@rektdeckard rektdeckard commented Jul 10, 2026

Copy link
Copy Markdown
Member

https://linear.app/livekit/issue/DEVX-575/build-cli-poc-for-user-auth-and-list-projects
https://linear.app/livekit/issue/DEVX-577/implement-dual-mode-auth-routing-in-the-cli

  • Adds experimental user-based authentication to begin implementing the new Public API service
    • Adds client codegen for the OpenAPI spec
    • Implements lk cloud auth flow for user sessions.
    • Implements lk project list, lk project get, lk project create, lk project update, and lk project delete commands using the new client behind --experimental-auth flag.
    • Implements net-new lk workspace, lk user, lk simulation commands.
    • Cache user's projects for recall with the --project <my-project> flag
      • On cache miss, the project cache is refreshed, meaning you don't have to synchronize anything to run commands against a new project.
    • Adds nudge to reauthenticate with new method if you have not already (and don't explicitly specify to use --legacy-auth)

Architecture

The CLI config file now stores a list of authenticated User credentials, including name, session token, and a cache of their projects. This lives alongside the existing Project credentials, and either can be used interchangeably for supported commands. Once the Public API is complete, this will be the default authentication mode for all commands.

Commands that support user-based authentication are routed through the API client in pkg/public. To run client codegen:

go generate -tags oapigen ./pkg/public/...

Usage

A hidden global --experimental-auth flag gates all experimental API variants of commands. Unimplemented commands return an error. To authenticate using the new flow against staging:

lk cloud auth \
  --experimental-auth \
  --server-url https://cloud-api-server-public.ochicago1a.staging.livekit.app \
  --dashboard-url https://cloud.staging.livekit.io

To run new versions of the commands:

lk project list --experimental-auth

The default API URL can be overridden with the --experimental-api-url flag when running the API server locally:

lk project list --experimental-auth --experimental-api-url "http://localhost:8000"

Note that at the moment, prod Public API Server will return "unimplemented" for all commands.

@rektdeckard rektdeckard changed the title feat(auth): add support for user-based auth, OpenAPI spec client codegen feat(auth): add support for user-based auth, OAPI client codegen Jul 10, 2026
@rektdeckard
rektdeckard requested review from a team, cacheonly, kuba-- and shishirng July 10, 2026 19:27
@rektdeckard
rektdeckard force-pushed the tobiasfried/devx-577-implement-dual-mode-auth-routing-in-the-cli branch 2 times, most recently from 609876b to b5c94d0 Compare August 19, 2026 00:03
@rektdeckard
rektdeckard requested a review from barrust August 19, 2026 00:31
@rektdeckard rektdeckard changed the title feat(auth): add support for user-based auth, OAPI client codegen feat(auth): add support for user-based auth, public-api-server Aug 19, 2026
@Topherhindman
Topherhindman requested review from Topherhindman and removed request for Topherhindman August 27, 2026 23:23
@rektdeckard
rektdeckard force-pushed the tobiasfried/devx-577-implement-dual-mode-auth-routing-in-the-cli branch from b5c94d0 to 7d0af3e Compare September 11, 2026 00:23
@rektdeckard
rektdeckard marked this pull request as ready for review September 11, 2026 16:44
@rektdeckard
rektdeckard force-pushed the tobiasfried/devx-577-implement-dual-mode-auth-routing-in-the-cli branch from c3263cc to 008d475 Compare September 11, 2026 17:21

@Topherhindman Topherhindman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

overall i think this is v good. couple of preguntas

Comment thread cmd/lk/project_members.go Outdated
Comment thread pkg/public/client.go
Comment thread cmd/lk/experimental_auth.go
Comment thread cmd/lk/experimental_auth.go
Comment thread cmd/lk/analytics.go
Comment thread pkg/public/workspaces.go Outdated
Comment thread cmd/lk/project_members.go Outdated
Comment thread cmd/lk/cloud.go
Comment thread cmd/lk/project.go Outdated
Comment thread pkg/public/client.go

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add some tests for this file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

@rektdeckard
rektdeckard force-pushed the tobiasfried/devx-577-implement-dual-mode-auth-routing-in-the-cli branch from db70fa5 to 877cf48 Compare September 12, 2026 05:07
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.

2 participants