Access tokens allow us to identify you or your application as part of your organisation and give you access to the resources that belong to you or have been shared with you.

Authenticate with OAuth

re.alto uses OAuth 2.0 Client Authorisation. This allows us to secure your data so that only you and those who you allow access can see it. In order to authenticate with OAuth, you may provide a client_id and client_secret.

After successful authentication, you receive a temporarily valid access token (a Bearer token) that you can use to authorise other API requests.

1. Creating an access (Bearer) token

Access tokens can be temporarily used to authorise API requests. You can request a (new) token by making an API request using your API credentials (client_id and client_secret). We use JWT tokens, which can be decoded to determine when they expire.

You can get an access token by making a POST request on the Retrieve a bearer token endpoint, like in this example:

Request
curl --request POST \
     --url https://platform.realto.io/api/v1/authentication \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
       {
        "clientId": "your-client-id",
        "clientSecret": "your-client-secret"
       }
     '
Response
{
	"access_token": "eyJ0eXAi[...]",
	"expires_in": 3599,
	"token_type": "Bearer"
}

2. Authorise an API request

To authorise your API requests, you’ll have to provide a valid Bearer token in the Authorization header of that request. The Bearer token is your access token.

In the following example request, your-bearer-token has to be replaced with your token:

Request
curl --request GET \
     --url https://platform.realto.io/api/v1/entities/a6c16eda-52b9-4612-b871-1466a6b0857c/readings/last \
     --header 'accept: application/json' \
     --header 'authorization: Bearer your-bearer-token'