Skip to main content

core.medplumclientoptions

Home > @medplum/core > MedplumClientOptions

MedplumClientOptions interface

The MedplumClientOptions interface defines configuration options for MedplumClient.

All configuration settings are optional.

Signature:

export interface MedplumClientOptions 

Properties

Property

Modifiers

Type

Description

accessToken?

string

(Optional) The OAuth Access Token.

Access Token used to connect to make request to FHIR servers

authorizeUrl?

string

(Optional) OAuth2 authorize URL.

Default value is baseUrl + "/oauth2/authorize".

Can be specified as absolute URL or relative to baseUrl.

Use this if you want to use a separate OAuth server.

autoBatchTime?

number

(Optional) The length of time in milliseconds to delay requests for auto batching.

Auto batching attempts to group multiple requests together into a single batch request.

Default value is 0, which disables auto batching.

baseUrl?

string

(Optional) Base server URL.

Default value is https://api.medplum.com/

Use this to point to a custom Medplum deployment.

cacheTime?

number

(Optional) The length of time in milliseconds to cache resources.

Default value is 60000 (60 seconds).

Cache time of zero disables all caching.

For any individual request, the cache behavior can be overridden by setting the cache property on request options.

See: https://developer.mozilla.org/en-US/docs/Web/API/Request/cache

clientId?

string

(Optional) The client ID.

Client ID can be used for SMART-on-FHIR customization.

clientSecret?

string

(Optional) The client secret.

Client secret can be used for FHIR Oauth Client Credential flows

createPdf?

CreatePdfFunction

(Optional) Create PDF implementation.

Default is none, and PDF generation is disabled.

extendedMode?

boolean

(Optional) Optional flag to enable or disable Medplum extended mode.

Medplum extended mode includes a few non-standard FHIR properties such as meta.author and meta.project.

Default is true.

fetch?

FetchLike

(Optional) Fetch implementation.

Default is window.fetch (if available).

For Node.js applications, consider the 'node-fetch' package.

fhircastHubUrl?

string

(Optional) FHIRcast Hub URL.

Default value is fhircast/STU3.

Can be specified as absolute URL or relative to baseUrl.

Use this if you want to use a different path when connecting to a FHIRcast hub.

fhirUrlPath?

string

(Optional) FHIR URL path.

Default value is "fhir/R4/".

Can be specified as absolute URL or relative to baseUrl.

Use this if you want to use a different path when connecting to a FHIR server.

logoutUrl?

string

(Optional) OAuth2 logout URL.

Default value is baseUrl + "/oauth2/logout".

Can be specified as absolute URL or relative to baseUrl.

Use this if you want to use a separate OAuth server.

onUnauthenticated?

() => void

(Optional) Callback for when the client is unauthenticated.

Default is do nothing.

For client side applications, consider redirecting to a sign in page.

redirect?

RequestRedirect

(Optional) The default redirect behavior.

The default behavior is to not follow redirects.

Use "follow" to automatically follow redirects.

refreshGracePeriod?

number

(Optional) The refresh grace period in milliseconds.

This is the amount of time before the access token expires that the client will attempt to refresh the token.

Default value is 300000 (5 minutes).

resourceCacheSize?

number

(Optional) Number of resources to store in the cache.

Default value is 1000.

Consider using this for performance of displaying Patient or Practitioner resources.

storage?

IClientStorage

(Optional) Storage implementation.

Default is window.localStorage (if available), this is the common implementation for use in the browser, or an in-memory storage implementation. If using Medplum on a server it may be useful to provide a custom storage implementation, for example using redis, a database or a file based storage. Medplum CLI is an an example of FileSystemStorage, for reference.

tokenUrl?

string

(Optional) OAuth2 token URL.

Default value is baseUrl + "/oauth2/token".

Can be specified as absolute URL or relative to baseUrl.

Use this if you want to use a separate OAuth server.

verbose?

boolean

(Optional) When the verbose flag is set, the client will log all requests and responses to the console.