Parancssor (CLI)

CLI-hitelesítés

Böngészős bejelentkezés eszközfolyamattal, vagy API-kulcs környezeti változóban.

Which method to use

SituationMethod
Your computer with a browser.posty auth:login
Server, container, scheduled run, CI.POSTY_API_KEY environment variable

Browser sign-in

posty auth:login

The command opens a browser, where you approve access with a code. The CLI then stores the credential on your machine, so you don't have to put it in your scripts, and it doesn't end up in your command history.

The approval page opens even if you aren't signed in

This is intentional. If you aren't signed in, you first see what you are approving, including the device and code. You sign in only after that. Nothing is approved unless you sign in.

API key via an environment variable

If there's no browser, put the API key in an environment variable. Create the key in Posty under Settings → Developers. See the Developer settings page.

export POSTY_API_KEY=psty_a_kulcsod
posty integrations:list
  • Stored sign-in credentials take precedence over the environment variable.
  • Pass the key through a secrets manager. Don't put it in the script or commit it to version control.
  • For scheduled runs, it's also a good idea to set the POSTY_TIMEZONE variable so the dates are unambiguous.

Status and logout

posty auth:status   # melyik munkaterülethez van kötve a gép
posty auth:logout   # a tárolt hitelesítő adat törlése

auth:status doesn't just print the status. It also checks the credential with a real call. If that works, authentication is working. Any errors after that relate to the command itself.

Your own backend

By default, the CLI connects to the posty.hu service. To connect to another instance, use the --auth-server flag or the POSTY_API_URL variable.

export POSTY_API_URL=https://sajat-peldany.example/api
posty auth:login --auth-server https://sajat-peldany.example/api
Is something missing from this page? Email [email protected] or use the form on the Help page.