Guides
Guides
Guides

Authentication and authorization

Retrieving a JSON Web Token to make requests to our API

After logging into our web app at https://sandbox.web.caliza.co, you can access yourclient-id and client-secret on the Profile page, as shown below:

Now that you have a Caliza account, client-id and client-secret, it's time to start making some API requests! The last step is getting the JWT for your requests.

All you have to do is make a request to the token endpoint, as below:

curl --request POST 'https://sandbox.api.caliza.co/auth/realms/caliza/protocol/openid-connect/token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'client_id=your_client_id' \
  --data-urlencode 'client_secret=your_client_secret' \
  --data-urlencode 'grant_type=password' \
  --data-urlencode 'scope=openid' \
  --data-urlencode 'username=your_user_name' \
  --data-urlencode 'password=your_password'
{
    "access_token": "your_access_token",
    "expires_in": 36000,
    "refresh_expires_in": 1800,
    "refresh_token": "your_refresh_token",
    "token_type": "Bearer",
    "id_token": "your_id_token",
    "not-before-policy": 0,
    "session_state": "session_state",
    "scope": "openid email profile"
}

Now you are ready to start making requests to the Caliza API using your access_token. Set the Authorization header of all requests to Bearer {access_token}.