Machine To Machine Communications

Accessing Lifen's APIs in Machine To Machine involves obtaining an Access Token with the Client credentials grant flow of OAuth 2.0 from a back-end server.

Get a token

A request to Lifen must be perfomed to generate an access token. In the request, the client has to provide his credentials and some configuration.

Here is a request example:

curl --request POST \
  --url 'https://authentication.post-prod.lifen.fr/v1/token' \
  --data 'client_id=clientidclientidclientid' \
  --data 'client_secret=clientsecretclientsecret' \
  --data 'audience=https://post-prod.platform-apis/' \
  --data 'database_reference=KA5hEDzf73' \
  --data 'grant_type=client_credentials'

The following parameters are important:

  • client_id, which you obtain from your account manager

  • client_secret, which you obtain from your account manager

  • audience is the domain where your access token is available

  • database_reference which you obtain from your account manager, is the identifier connecting your application with a healthcare organization

  • grant_type allows you to request server to server Lifen's API

You will get an HTTP 200 response with a payload containing the access_token.

Perform an API call

The Access Token allows you to make requests to the API on the behalf of the client. Each request must include the Access Token in
the Authorization header using the Bearer format.

Example :

curl -H "Authorization: Bearer $ACCESS_TOKEN" https://api.lifen.fr/fhir/v3/$endpoint