feat: CLI authentication — login, token storage, auto-refresh
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- go
- Domain
- api, authentication, cli
Research direction
Start by reviewing the previous auth/oidc package referenced in salt evolution PR #85 and the integration points in salt/cli. Define how LoginCmd, LogoutCmd, Token, Client, secure token storage, refresh, and the PKCE flow fit together. Done means the five listed components are implemented as a usable CLI authentication package.
Written by the indexing model from the issue text.
Description
Context
The current auth/oidc package provides only the OIDC/PKCE browser flow for token acquisition. It's incomplete — no token storage, no refresh, no HTTP client integration. No raystack project uses it.
Meanwhile, every raystack CLI (frontier, compass, guardian) connects to APIs without authentication, which only works in development/trusted environments. Production APIs require auth, and CLIs have no way to authenticate.
Proposed solution
A complete CLI auth package following the pattern of gh auth login, gcloud auth login, and terraform login:
// Login — opens browser, does OIDC, stores token
auth.Login(ctx, auth.Config{
Issuer: "https://accounts.google.com",
ClientID: "...",
RedirectURL: "http://localhost:5454",
})
// Token — reads stored token, refreshes if expired
token, err := auth.Token(ctx)
// Client — returns http.Client that auto-attaches the token
client := auth.Client(ctx)
Components
- Token acquisition — browser-based OIDC with PKCE (existing code from dropped
auth/oidc) - Token storage — secure local storage at
~/.config/raystack/<app>/token.json - Token refresh — auto-refresh expired tokens using refresh_token
- HTTP client —
http.RoundTripperthat reads stored token and attaches to requests - CLI commands —
LoginCmd()andLogoutCmd()for easy integration withcli.Execute()
Integration with salt/cli
cli.Execute(
cli.Name("frontier"),
cli.Commands(
auth.LoginCmd(authConfig),
auth.LogoutCmd(),
userCmd, groupCmd,
),
)
// In commands:
func newListCmd() *cobra.Command {
return &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
client := auth.Client(cmd)
// make authenticated API calls
},
}
}
References
- GitHub CLI auth: https://github.com/cli/cli/tree/trunk/internal/authflow
- Previous
auth/oidcpackage (dropped in salt evolution PR #85) had the PKCE flow
- Dominant language
- Go
- Stars
- 14
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raystack/salt
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100