Linking Tokens to practitioner roles
# support
j
Hi, I would like to find out is it possible to link token to a practitioner role/access policy? I would like to know if medplum has something or if its something I have to build. let me give an example: We are using medplum external auth with Auth0. now Doctor John Doe has access to 2 hospitals that he works(multi tenant org)), when he is signed in to hospital A, he should not be able to access resources of org B and vice versa. We are able to pass Orgs A id into the token claims. but we would like to know if medplum has something we can leverage
r
Medplum supports this data partitioning via Projects (for example Project 1 might be hospital 1 and Project 2 hospital 2) - would that work for this case?
j
Hi @reshma , We are looking to have both hospitals in the same project so the patients data can easily be view at another hospital if granted permissions. so i guess in this case if we want to do that added restriction we have to have some custom code right?
r
It is possible to have two ProjectMemberships for the same Project, each with a different access policy. When authenticating the user would have an option to pick which one they wanted to select in the drop down.
j
were using auth0 and doing an exchange token so is it possible for us to pass the projectMembership we want?
r
The /oauth2/token endpoint accepts membership_id in the request body (see packages/server/src/oauth/token.ts line 361). So you can use the endpoint to do it. The SDK does not expose that - but if it is useful to you perhaps consider filing an issue for it?
j
thanks I will definitely take a look
Hey @reshma , thanks for your response i think its answered my question. I also created the issue https://github.com/medplum/medplum/issues/8139. My team and I are discussing on which route to go between this route or this https://www.medplum.com/blog/multi-tenant-mso#access-control in the mean time.
40 Views