Skip to content

Sign-in and profile API

eaxScadaReferenceStarterProEnterpriseView as Markdown

How a client signs in to eaxScada, asks who it is, and signs out. Every route of the server, with the role it needs: HTTP API routes.

A request carries its session in one of these, in this order: an Authorization: Bearer <token> header, then (for a live-data socket handshake only) a token query parameter, then the scada_session cookie. An API token (eaxt_...) is sent as a bearer token; it opens no session (see Connect an MCP client).

eaxScada’s own browser pages use the scada_session cookie only. They keep no token in Web Storage and send no Authorization header. The token in the sign-in answer is for programmatic clients. A script that read localStorage.scada_token must use an API token instead. See Where the browser keeps the session.

Each request of a session reads the account again. A session whose account is no longer active, or cannot be read from the security store, is refused with 401 ("status": "unauthorized", "error": "Unauthorized: user account no longer active"); a page request is sent to the sign-in page instead.

Public. Body:

{ "username": "jdoe", "password": "..." }
Answer When
200 Signed in. Sets the scada_session cookie (HttpOnly, SameSite Lax) and returns the body below.
400 {"error": "Invalid JSON"} The body is not JSON.
401 {"error": ...} Wrong user name or password, or the account is locked or disabled (account lifecycle).
401 {"error": "sign-in refused: the security store is unavailable; try again in a moment"} The security store is reopening or down after a failed write, or could not save this sign-in (its last-login time, a failed attempt, or the reset of an expired lockout). No session is opened, whatever the password. Try again in a moment; the server log says why (When the security store reopens after a failed write).
403 {"status": "password_change_required"} The account still has its first password: no session is opened; change it with POST /api/auth/change-default-password.
405 Not a POST.
{
"token": "…",
"expires_at": 1763300000,
"user": { "id": "…", "username": "jdoe", "full_name": "…", "roles": ["Shift_Operator"], "groups": [], "status": "active", "…": "…" },
"permissions": { "user": { … }, "roles": [ … ], "groups": [ … ], "permissions": [ … ], "publish_allow_topics": [ … ], "publish_deny_topics": [ … ], "sub_allow_topics": [ … ], "sub_deny_topics": [ … ] }
}

expires_at is in Unix seconds. The user never carries a password hash.

Any signed-in user, and an API token (GET and HEAD only). Returns {"user", "permissions"} as at sign-in, plus api_token (id, name, prefix, expires_at, never the secret) when the caller is an API token. Without a valid session or token: 401 {"error": "not authenticated"}.

When the server cannot read the caller’s roles, groups or rules from the security store, both answers above carry:

{
"permissions": null,
"permissions_error": "permissions could not be read; every permission check refuses until the security store is readable"
}

The sign-in still opens the session, so that an Administrator can reach security administration and repair the store. Meanwhile every permission check on the server refuses (see When the security store cannot be read). A client must treat permissions: null as no rights, never as all rights. permissions_error is absent when the permissions were read.

While the whole store is reopening or down, no session is opened at all: the sign-in answers 401 “sign-in refused: the security store is unavailable; try again in a moment”, and existing sessions get 401 on each request until the store serves again.

Any signed-in user (POST only; another method answers 405). Ends the session, clears the scada_session cookie and answers {"success": true}.