Getting started

Prerequisites

Before you begin, ensure you have:

  • cURL or an HTTP client installed

  • Basic knowledge of REST APIs

  • Information needed for retrieving JWT token such as USERNAME, PASSWORD, CLIENT_SECRET

Get a user token

JWT token request

To communicate with backend, you will need a User JWT Token. Use the curl request below to retrieve it

curl --request POST \
  --url https://auth.ai-dapt.s5projects.eu/realms/ai-dapt/protocol/openid-connect/token \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data client_id=main \
  --data username=[USERNAME] \
  --data 'password=[PASSWORD] \
  --data grant_type=password \
  --data client_secret=[CLIENT_SECRET]

JWT token response

{"access_token":"usertoken","token_type":"Bearer","not-before-policy":1763562061,"session_state":"state","scope":"email profile"}

Make a request

Use the retrieved token from the previous request, to make an api call to the backend.

curl --request GET \
  --url http://example.com/user \
  --header 'Authorization: Bearer [userToken]'

Error Handling

Common HTTP status codes:

  • 200 OK - Request succeeded

  • 400 Bad Request - Invalid parameters

  • 401 Unauthorized - Invalid or missing API key

  • 429 Too Many Requests - Rate limit exceeded

  • 500 Internal Server Error - Server error