Authenticate with the Salto Space API
The Space API uses the OAuth 2.0 client credentials flow. Your application requests an access token from the Salto IDM identity server, then sends the token with every API call.
You need the client ID and secret of your API client. Salto issues them when it connects your Salto Space installation to the Space API. See Connect Salto Space to the Space API on the Salto support site.
To authenticate:
Request an access token from the Salto IDM identity server with the OAuth 2.0 client credentials flow. Send the client ID and secret as a Basic authentication header:
bashcurl --request POST "https://identity.saltoidm.app/connect/token" \ --user "CLIENT_ID:CLIENT_SECRET" \ --header "Content-Type: application/x-www-form-urlencoded" \ --data "grant_type=client_credentials"The response contains the
access_token, itstoken_typeofBearer, andexpires_in, the number of seconds the token stays valid. Request a new token when it expires.Call the Space API at the base URL
https://space.api.saltoidm.appwith the token in theAuthorizationheader. The following request gets the first user:bashcurl "https://space.api.saltoidm.app/api/v1/users/Filtered?maxCount=1" \ --header "Authorization: Bearer ACCESS_TOKEN"Every response contains
Data,Success, andMessage.