/auth/loginSign in
Exchanges an email address and password for an access token, or reports that two-factor verification is still required before a token is issued.
A successful sign-in returns the access token that every authenticated endpoint
expects as Authorization: Bearer <access-token>. It also sets a secure refresh
cookie through Set-Cookie, which POST /auth/refresh
later uses to issue a fresh access token without asking for the password again.
Keep the returned sid, since refreshing needs it.
Read requires_2FA before you use anything else in the response. When it is
false, as in the sample, token is your access token and token_2fa is
unused. When it is true, token is empty and the sign-in is not finished:
take the token_2fa value and the one-time code sent to the account's email
address and complete the sign-in with
POST /auth/otp-validate. The user_info object is
the User shape described in Shared objects, and it
carries the organisations, workspaces, and role the account can work in.
A response with "success": true and an empty "token" means two-factor
verification is outstanding, not that the call went wrong. Branch on
requires_2FA rather than on whether a token is present.
emailstringrequiredpasswordstringrequiredlocationstringoptionaldevicestringoptional#What happens next
With requires_2FA false, send token as a bearer token on every later call
and refresh it with POST /auth/refresh before it expires.
With requires_2FA true, the platform emails a one-time code to the account and
waits: nothing is signed in until
POST /auth/otp-validate accepts that code together
with token_2fa. If the password is the problem instead, start a reset with
POST /auth/request-password-reset.