POST /auth/register
Creates the account. First user on a fresh install is admin. Sets a token cookie in browsers.
json
curl -X POST https://api.portlify.ru/auth/register \
-H "Content-Type: application/json" \
-d '{"mail":"you@domain.com","password":"at-least-8"}'Response: { user, token }. Password minimum 8 characters. 409 if the email exists.
POST /auth/login
curl -X POST https://api.portlify.ru/auth/login \
-H "Content-Type: application/json" \
-d '{"mail":"you@domain.com","password":"at-least-8"}'Same shape as register. 401 on bad credentials.
POST /auth/logout
Clears the cookie. Call it from the site. CLI uses portlify logout to drop the saved key.
CLI device login
POST /auth/cli/startwith{ "redirectUri": "http://127.0.0.1:<port>/callback" }returnscode,pollToken,verifyUrl- User opens
verifyUrlwhile logged in on the site and approves - Site calls
POST /auth/cli/approve(JWT required) with the code - CLI polls
POST /auth/cli/pollwithpollTokenuntil it gets aplfy_key
redirectUri must be localhost HTTP /callback, or a portlify: URL.