Redirector Application Use

To use redirector for a directory endpoint OAuth flow the client will first do a search on directory for the endpoint that will be used to authenticate the user and gather their clinical and/or payer data. The search can be for a term or a specific endpoint id if known. For example a search for clinical endpoints matching the term “epic” ( provides the following response body (partial):

        "name": "Epic New",
        "vendor": "Epic",
        "endpointStatus": "active",
        "disposition": "1",
        "dataType": "clinical",
        "derivedAuthUri": "",
        "redirectUri": "",
        "_id": "8e9cb0f7-f920-49c3-ad23-b54b8a9ebe9f",
        "parent_org": "Sandbox"

The client would use the value in redirectUri to forward the application user to the endpoint's Authentication and Authorization portal so that the user/patient can give access to OneRecord's registered client to their health records.

The client would need to add an extra query parameter to redirectUri in order for the redirector app (middle man application provided for OAuth authentication to any given FHIR endpoint).


The clientURL is the url that will receive the code and status values generated during patient authentication with the FHIR endpoint's portal. This URL runs on the client side and redirector will send the user to this URL once the portal user authentication and authorization process has been completed and the FHIR portal has generated a code to be used for building an access token for the FHIR APIs.

As an example lets say the client has built a web page at that will receive the code generated by the FHIR OAuth server during patient authorization. This would be the clientURL added to the redirectUri which will result in the following URL:

Notice that we have added the client URL value in URL encoded form.

This is the URL that the browser needs to be sent to for authentication and authorization.

One requirement is that the user needs to stay on the current tab/window, spanning a new tab or window will cause issues with redirector holding session variables that are needed for this process.

Once the user has authorized access to the FHIR data the browser will land at:{{oauth-code}}&state={{oauth-state}}

Where {{oauth-code}} is the code generated by the FHIR endpoints OAuth server and {{state}} is an autogenerated state value that redirector uses as verification with the API.

The client application should then be able to use these values to call the OneRecord integrator API to request an access token from the FHIR OAuth server.

That call is to with the following body:

"state": "{{oauth-state}}",
"authorizationCode": "{{oauth-code}}"
The response will contain the authenticated token to use in the request for FHIR resource to the OneRecord API.