Stream: smart
Topic: fhir-client.js additional scopes
Keller Martin (Feb 26 2021 at 21:20):
Hey all, I'm trying to implement custom scope requests from my client to a fhir server re: http://www.hl7.org/fhir/smart-app-launch/scopes-and-launch-context/#requesting-context-with-scopes.
Anyone with fhir-client.js knowledge know if it's possible to request additional scopes from the client? For example:
// launch.js
scope: launch/patient launch/{custom-scope}...
...
//index.js
FHIR.oauth2.ready()
.then(async (client) => {
await client.patient.read()....
// grab custom scope here
await client.request({custom-scope}).then()...
}
This will not work, but I'm not sure if there is a way to do this.
Ian Bacher (Feb 26 2021 at 21:51):
Assuming you've already requested the custom scope and your auth provider places the custom scope in the launch context, then I think client.state.tokenResponse.custom-scope
should get it.
Keller Martin (Feb 26 2021 at 22:03):
Thanks @Ian Bacher , that's what I needed. I'm doing my development without having a server to actually grant the custom scope, so I'm a bit blind here. I'll implement it this way, thanks.
Last updated: Apr 12 2022 at 19:14 UTC