What is the problem this would solve and/or feature it would enhance?
Problem
Authentication currently relies on export PROLIFIC_TOKEN=... (read via viper.GetString("PROLIFIC_TOKEN") in client/client.go). As a new user working through the README, I hit a few rough edges with this:
- It doesn't persist — the token lives in the shell session, so it has to be re-exported in every new terminal (or manually added to a shell profile).
- It can leak into shell history —
export PROLIFIC_TOKEN=<secret> typically lands in .bash_history / .zsh_history in plaintext.
- No validation at entry — an invalid token isn't caught until the first API call (e.g.
prolific whoami).
For comparison, other CLIs (gh auth login, stripe login, vercel login) offer an interactive login that validates the credential and stores it securely.
Proposed solution
Add a prolific login command that:
- Prompts for the API token with hidden input (so it never hits shell history).
- Validates it immediately (e.g. a
whoami call) and reports success with the authenticated user's name/email.
- Persists it to a config file (e.g.
~/.config/prolific/config.yaml) with 0600 permissions.
- Optionally
prolific login --web to open the token page (app.prolific.com/researcher/tokens/) directly.
Plus prolific logout to clear the stored credential.
Why this fits
The project already uses Viper, which supports layered config with a clear precedence order. So we could resolve the token as:
PROLIFIC_TOKEN env var → config file → error
This keeps CI and scripting unchanged (env var still wins, important for automation and the existing test setup, which doesn't need a token), while giving interactive users a persistent, secure default. Minimal new surface area, no new dependency.
Scope / notes
- Happy to keep this focused:
login, logout, and the Viper precedence wiring, with tests using the existing mock client.
- I don't know your roadmap so you may already have this planned or have reasons for env-var-only. Flagging it as a first-run UX improvement and glad to discuss the approach before opening a PR.
I'd be happy to implement this if it's something you'd welcome.
What is the problem this would solve and/or feature it would enhance?
Problem
Authentication currently relies on
export PROLIFIC_TOKEN=...(read viaviper.GetString("PROLIFIC_TOKEN")inclient/client.go). As a new user working through the README, I hit a few rough edges with this:export PROLIFIC_TOKEN=<secret>typically lands in.bash_history/.zsh_historyin plaintext.prolific whoami).For comparison, other CLIs (
gh auth login,stripe login,vercel login) offer an interactive login that validates the credential and stores it securely.Proposed solution
Add a
prolific logincommand that:whoamicall) and reports success with the authenticated user's name/email.~/.config/prolific/config.yaml) with0600permissions.prolific login --webto open the token page (app.prolific.com/researcher/tokens/) directly.Plus
prolific logoutto clear the stored credential.Why this fits
The project already uses Viper, which supports layered config with a clear precedence order. So we could resolve the token as:
PROLIFIC_TOKENenv var → config file → errorThis keeps CI and scripting unchanged (env var still wins, important for automation and the existing test setup, which doesn't need a token), while giving interactive users a persistent, secure default. Minimal new surface area, no new dependency.
Scope / notes
login,logout, and the Viper precedence wiring, with tests using the existing mock client.I'd be happy to implement this if it's something you'd welcome.