Authentication
Bulk FHIR

Token endpoint

Exchange an authorization code for tokens, refresh a token, or obtain a client_credentials token. The same endpoint serves both interactive apps and Bulk FHIR backend services — which fields you send depends entirely on your grant_type.

authorization_code / refresh_token (interactive apps)

Send client_id/client_secret in the body (client_secret_post).

client_credentials (Bulk FHIR / backend services)

No client_secret — authentication is private_key_jwt instead:

  • Send client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer and a client_assertion JWT, signed with the private key matching the public JWKS your client is registered with.
  • Assertion claims: iss/sub = your client_id, aud = this token endpoint URL, plus jti/iat/exp (a short expiry — 5 minutes is typical).
  • Signing algorithm confirmed working: ES384.
  • scope is required on this grant (space-separated system/*.rs scopes) — it's not implied the way it can be for the other two grants.

The schema below lists every field used across all three grants; see above for which combination applies to yours.

post/auth/realms/fhir/protocol/openid-connect/token

Request

  • Base URL
    https://sso.ema.md
  • URL
    https://sso.ema.md/auth/realms/fhir/protocol/openid-connect/token
  • Auth
    none declared

Request body application/x-www-form-urlencoded

grant_typestring required

authorization_code, refresh_token, or client_credentials

codestring

Authorization code (authorization_code grant)

redirect_uristring

Must match the authorize request (authorization_code grant)

code_verifierstring

PKCE code verifier (authorization_code grant)

refresh_tokenstring

(refresh_token grant)

client_idstring

authorization_code and refresh_token grants only — client_credentials identifies the client via the client_assertion JWT's iss/sub claims instead

client_secretstring

authorization_code and refresh_token grants only — never sent on the client_credentials grant

client_assertion_typestring

client_credentials grant only

client_assertionstring

client_credentials grant only — a JWT signed with your private key, matching the public JWKS your client is registered with. See this endpoint's description for the required claims and confirmed signing algorithm.

scopestring

Required on the client_credentials grant (space-separated system/*.rs scopes). Optional on the other two grants.

Example request

{
  "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
  "scope": "system/Patient.rs system/Observation.rs"
}

Response

Token response

access_tokenstring
token_typestring
expires_ininteger
refresh_tokenstring

Present when offline_access is granted

scopestring
id_tokenstring

Present when the openid scope is requested

Example response

{
  "token_type": "Bearer"
}

Changes

No recorded changes to this operation across all 1 revision of this API.