Authorize
The authorize endpoint is used for end-user login, to enforce limits on the application’s requested scopes, and to capture consent before an access token is issued. Obtain the authorization endpoint URL from the FHIR service base URLs. During authorization, the server temporarily redirects the end user’s browser to the Elation EMR FHIR API login. The user is asked to log in or may be automatically authenticated using an existing session. The user is then prompted for scope limitations and the consent form, and is finally redirected back to the requesting app with an authorization code. The app then sends that code to the token endpoint to obtain an access token. This flow is a browser-only flow because the authorization server redirects the user’s browser to the provided redirect URL. The default value for the refresh token is 90 days. The application needs to use the offline token at least once during this period. Otherwise the offline session will expire. METHOD GETauthorization_endpoint - authorization endpoint URL SHALL be observed from the FHIR base url SMART .well-known configuration endpoint (authorization metadata)client_id - client ID for the registered developer applicationredirect_uri - URI for the developer’s application to which the browser is redirected after successful authorization. Must exactly match a redirect URI configured for the application’s client credentials during registrationscope - requested optional scopes by application delimited by space, case sensitive. At minimum client must request the OpenID Connect scope (openid) for successful authentication and to obtain an ID token in the token endpoint response. To obtain a refresh token in the token endpoint response, the client must request the offline_access scope. To perform a SMART App Launch sequence, the client must request either the launch or launch/patient scope (for provider EHR launch or patient standalone launch) in addition to resource-level scopes for those FHIR endpoints you will access through your app launch. For details, see scopes.state - a one-time use arbitrary string provided by the developer application (client) and subsequently returned by the authorize endpoint. The intent of this parameter, per OAuth specification, is for the application to compare the request and response values to prevent cross-site request forgery attacks.aud - FHIR base URL, used to specify the organization for which the end user will be authenticatedcode_challenge - PKCE code challenge generated from a cryptographically-random code verifier value. This parameter is only used by public FHIR clients without a client secret.code_challenge_method - Method used to generate the PKCE code challenge. The only supported value is S256. This parameter is only used by public FHIR clients without a client secret.
RESPONSEScode - authorization code generated by Elation EMR FHIR API authorization server and required to make a token requeststate - identical value to the state parameter provided in client app’s authorize request
Example
Access token
Obtain an access token. The token endpoint is used for 2-legged authorization applications. This method works only if the client supports this type of authorization. METHOD POST[token_endpoint url] - token endpoint URL SHALL be observed from the FHIR base url SMART
.well-known configuration endpoint (authorization metadata)
BODYThe body SHALL be provided as
application/x-www-form-urlencoded
client_id - ID for the client registered appgrant_type - ‘client_credentials’client_secret - client secret for the registered app. This parameter is only used by confidential FHIR clients that have a client secret.scopes - requested optional scopes delimited by space (e.g., patient/*.read launch/patient)code_verifier - the PKCE cryptographically-random code generated previously and used for obtaining the code_challenge authorization endpoint value. This parameter is only used by public FHIR clients without a client secret.
HEADERS
The Authorization token SHALL be obtained during the Authentication and Authorization process. Go to Authentication and Authorization for further details.
| Header | Type | Required/Optional | Value |
|---|---|---|---|
| Content-Type | string | required | application/x-www-form-urlencoded |
| Code | Description | Comment |
|---|---|---|
| 200 | OK | The request was processed successfully and access token returned |
| 400 | Bad request | Invalid request parameters, e.g. client id or grant type |
| 401 | Unauthorized | Invalid client secret |
| 404 | No route matched with those values | The request was able to communicate with a given server, but the server could not find what was requested |
| 500 | Internal Server Error | The server has encountered a situation it doesn’t know how to handle |
access_token- signed base64 JWT access tokenid_token- signed OpenID Connect ID token. This value is only returned when theopenidscope is requested.expires_in- time in seconds to token expirationrefresh_expires_in- time in seconds to token expirationtoken_type- fixed value:Bearerscope- list of the granted default client’s scopepatient- an optional identifier of the selected patient that is returned when any of thepatient/scopes or thelaunch/patientscope were requested.
- decoded access_token example
Token Introspection
Checks the status and content of a JWT token. METHOD POST[introspection_endpoint] - token introspection endpoint URL SHALL be observed from the FHIR base url SMART
.well-known configuration endpoint (authorization metadata)
BODYThe body SHALL be provided as
application/x-www-form-urlencoded
client_id - ID for the client registered appclient_secret - client secret for the registered apptoken - token value for the introspection
This endpoint can only be used by confidential FHIR clients with a client secret.
HEADERS
The Authorization token SHALL be obtained during the Authentication and Authorization process. Go to Authentication and Authorization for further details.
| Header | Type | Required/Optional | Value |
|---|---|---|---|
| Content-Type | string | required | application/x-www-form-urlencoded |
| Code | Description | Comment |
|---|---|---|
| 200 | OK | The request was processed successfully and access token returned |
| 400 | Bad request | Invalid request parameters, e.g. client id or grant type |
| 401 | Unauthorized | Invalid client secret |
| 404 | No route matched with those values | The request was able to communicate with a given server, but the server could not find what was requested |
| 500 | Internal Server Error | The server has encountered a situation it doesn’t know how to handle |
active- true or false. If token is active the additional token information will be providedexp- time to token expiration (seconds since Unix epoch)iat- time when token was issued (seconds since Unix epoch)jti- JWT id, unique token idsub- list of the granted default client’s scopeiss- token issuer and signertyp- type of the tokenazp- client (application)acr- authentication context classscope- granted scopes for the tokenclientId- optional client idclientHost- optional hostclientAddress- optional host
- RESPONSE:
Token Revocation
Token revocation is a mechanism for clients to indicate to the Elation EMR FHIR API authorization server that an access token is no longer needed. This is used to enable a “log out” feature in clients, allowing the authorization server to clean up any security credentials associated with the authorization. METHOD POST[revocation_endpoint] - token revocation endpoint URL SHALL be observed from the FHIR base url SMART
.well-known configuration endpoint (authorization metadata)
BODYThe body SHALL be provided as
application/x-www-form-urlencoded
client_id - ID for the client registered appclient_secret - client secret for the registered apptoken - token value for the revocation
HEADERS
The Authorization token SHALL be obtained during the Authentication and Authorization process. Go to Authentication and Authorization for further details.
| Header | Type | Required/Optional | Value |
|---|---|---|---|
| Content-Type | string | required | application/x-www-form-urlencoded |
| Code | Description | Comment |
|---|---|---|
| 200 | OK | The request was processed successfully and the token has been revoked |
| 400 | Bad request | Invalid request parameters, e.g. client id or client_secret or token |
| 404 | No route matched with those values | The request was able to communicate with a given server, but the server could not find what was requested |
| 500 | Internal Server Error | The server has encountered a situation it doesn’t know how to handle |