Skip to content

Authentication

Hausing uses OAuth 2.0 Bearer tokens for authentication. Machine-to-machine authentication is done with OpenID Connect (OIDC).

  • Client ID and Client Secret — please contact support to obtain these

Use a POST request to the token endpoint to obtain an authentication token.

Parameters:

  1. grant_type — use the string client_credentials as value
  2. client_id — obtained from Hausing support
  3. client_secret — obtained from Hausing support

Example:

Terminal window
curl -X POST 'https://keycloak.prod.hausing.ee/realms/Hausing/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=unique-id' \
--data-urlencode 'client_secret=super-secret-random-string'

Response:

{
"access_token": "jwt.token.value",
"expires_in": 300,
"refresh_expires_in": 0,
"token_type": "Bearer",
"not-before-policy": 1637159808,
"scope": "profile email contracts"
}

Use the access_token from the response to authenticate all Hausing REST API requests.