Skip to main content

Sign in and get an access token

POST 

/login

Authenticates a user and returns a JWT access token. Send the token on later calls as Authorization: Bearer <access-token>.

Three kinds of account can sign in:

  • Active Directory user: send username, domain (NetBIOS name) and password. The user must be provisioned in the product (directly or through group membership).
  • Built-in service account: send username secureone and password with no domain. The account is superadmin and is disabled until its password has been changed from the default.
  • SAML single sign-on: when SSO is enabled, the identity provider posts its SAML response to this endpoint. On success the server answers with a 301 redirect to /#/login?samlAuth=<access-token> instead of a JSON body. This flow is meant for browsers.

Two-factor authentication. Depends on how the server is configured.

  • No second factor configured for the user: one call returns the token.
  • RADIUS enabled: always send code (the one-time password). Without it the server returns 401 with code 2FA_Token_Required.
  • Built-in time-based one-time password (TOTP) enabled for the user and already enrolled: send code. Without it the server returns 401 with code 2FA_Token_Required.
  • TOTP enabled but not yet enrolled: the first call (no code) returns 200 with code 2FA_Config_Required and a base32 key. Add key to an authenticator app, then call again sending the same key and the current six-digit code. The server stores the key and returns the token.

The token lifetime is configurable by the administrator (default 10 hours). Read expires in the response instead of assuming a fixed lifetime. There is no refresh endpoint; sign in again.

Both application/json and application/x-www-form-urlencoded bodies are accepted.

Required role: none (no authentication needed).

Request​

Responses​

Access granted, or the user must enroll a second factor. Check code in the body: when it is 2FA_Config_Required no token is issued yet.