Security
Call the API from outside
Create a Cloudflare Access service token so Postman, curl and scripts can reach the FHIR server without the email login.
An Access service token is a client id and secret pair that a machine sends in HTTP headers in place of a browser login.
Create the token#
Zero Trust → Access controls → Service credentials → Service Tokens → Create. Name it after the tool (postman-laptop) and choose a duration. Copy the secret now: it's shown only once.
Allow it on the FHIR app#
Access controls → Applications → fhir → Policies → Add a policy:
| Field | Value |
|---|---|
| Name | Service tokens |
| Action | Service Auth |
| Include | Service Token → postman-laptop |
Service Auth policies are checked before Allow policies, and they don't trigger the email login.
Send the headers#
curl -s https://fhir.fhirdrill.dev/fhir/metadata \
-H "CF-Access-Client-Id: <id>.access" \
-H "CF-Access-Client-Secret: <secret>" | jq .softwareIn Postman, put both headers on the collection, using variables with the secret stored as a secret-type variable.
One token per tool
Make a separate token for each tool or script. Then one can be revoked without breaking the others, and the Access logs show which tool made each request.