Skip to content

2. Authenticate ​

Every API call carries an access token as a Bearer token. While developing, get one with your test account's email and password:

http
POST https://test-secure.salaxy.com/oauth2/token
Content-Type: application/json

{
  "grant_type": "password",
  "username": "you@example.com",
  "password": "your-password"
}

The response's access_token goes into the Authorization header of every call in the next steps:

http
Authorization: Bearer eyJhbGciOi...
  • The password flow is for development only — enabled in the test environments. Details: Password flow.
  • In production, use the impersonation flow: your server signs a JWT with its certificate and gets a token for the customer account.
  • Tokens currently last 48 hours, and there are no refresh tokens — see Tokens.

Test your connection ​

Before building anything, check that the token works. The session endpoint answers every request and tells you whether it was authorised:

http
GET https://test-secure.salaxy.com/v03/api/session/current
Authorization: Bearer eyJhbGciOi...

The response, trimmed to what matters here:

json
{
  "isAuthorized": true,
  "currentAccount": {
    "id": "<account id>",
    "avatar": { "displayName": "Your Test Company Oy" }
  }
}
  • isAuthorized: true — the token works, and currentAccount is the company you act as.
  • isAuthorized: false — the token was not accepted. Check that the header is Bearer followed by a space and the token, that the token comes from the same environment (test-secure), and that it is not older than 48 hours.

Check ​

  • POST /oauth2/token returns an access_token; a wrong password returns an error, not a token.
  • Every later call sends Authorization: Bearer <token>.
  • The token is not in source control or in your logs.
  • Test credentials are used only with test-secure.salaxy.com.

Runnable sample

The interactive version of this step — sign in and run it against your test account — is on the current developer site: api authentication. The runnable samples stay there; the steps and endpoints are here.

← 1. Create an account · 3. Create employees →

Every page is also available as Markdown: add .md to its URL — a folder page such as white-label/ is white-label/index.md. Index for LLMs: llms.txt. Questions: Support.