Builds the token request options. Does not make the request, just creates it's configuration and returns it in a Promise.
If provided overrides the clientPublicKeySetUrl
from the authorize
options (if any). Used for jku
token header in case of asymmetric auth.
The code
URL parameter received from the auth redirect
Can be a private JWK, or an object with alg, kid and key properties,
where key
is an un-extractable private CryptoKey object.
The app state
Fetches the well-known json file from the given base URL. Note that the result is cached in memory (until the page is reloaded in the browser) because it might have to be re-used by the client
The base URL of the FHIR server
Given a FHIR server, returns an object with it's Oauth security endpoints
that we are interested in. This will try to find the info in both the
CapabilityStatement
and the .well-known/smart-configuration
. Whatever
Arrives first will be used and the other request will be aborted.
This function can be used when you want to handle everything in one page (no launch endpoint needed). You can think of it as if it does:
authorize(options).then(ready)
Be careful with init()! There are some details you need to be aware of:
init()
will be called twice. First it will redirect to the
EHR, then the EHR will redirect back to the page where init() will be
called again to complete the authorization. This is generally fine,
because the returned promise will only be resolved once, after the second
execution, but please also consider the following:init()
resolves!The adapter
The authorize options
Checks if called within a frame. Only works in browsers!
If the current window has a parent
or top
properties that refer to
another window, returns true. If trying to access top
or parent
throws an
error, returns true. Otherwise returns false
.
Checks if called within another window (popup or tab). Only works in browsers! To consider itself called in a new window, this function verifies that:
self === top
(not in frame)!!opener && opener !== self
The window has an opener!!window.name
The window has a name
setAnother window can send a "completeAuth" message to this one, making it to navigate to e.data.url
The message event
The ready function should only be called on the page that represents the redirectUri. We typically land there after a redirect from the authorization server, but this code will also be executed upon subsequent navigation or page refresh.
Generated using TypeDoc
Starts the SMART Launch Sequence.