-
Notifications
You must be signed in to change notification settings - Fork 225
Open
Labels
Description
This API is not working out of the box with current auth implementaiton
https://docs.athenahealth.com/api/guides/token-endpoint#3legged_Token_Generation_2
fhirclient.server.FHIRServer.post_as_form sends client_id and client_secret in basic auth header, but for API above those parameters must be sent in request body and there is no way to change that except of monkey patching.
I do monkey patching right before handle_callback call to make it work
def post_as_form(self_, url, formdata, auth=None):
# monkey-patch fhirclient.server.FHIRServer.post_as_form
formdata["client_id"] = auth[0]
formdata["client_secret"] = auth[1]
res = self_.session.post(url, data=formdata)
self_.raise_for_status(res)
patch_response_json(res)
return res
self.fhir_client.server.post_as_form = post_as_form.__get__(self.fhir_client.server)
It would be nice to have some way to do that with options instead.