FHIR Chat · CARIN BlueButton/SMART on FHIR client-py · implementers

Stream: implementers

Topic: CARIN BlueButton/SMART on FHIR client-py


view this post on Zulip Stephen Whitney (Apr 09 2020 at 17:35):

Hello, I built a CARIN CPCDS Reference Server and CARIN CPCDS Authorization Server locally. I can make requests to the server-ri and authenticate via auth-server using oauth2 successfully. Now I am working on making the requests via a flask app within the smart on fhir client-py library. Should I be able to request an access token via the app, or would I need to pass the token to the app? Are there any available resources to aid me in getting this up and running? Thank you in advance!

cc @Harold Solbrig

view this post on Zulip Stephen Whitney (Apr 09 2020 at 18:13):

I register the app URL as http://localhost:8000/fhir-app/ and receive an app_id and app_secret outside of the flask app. I then pass the following as the settings:

smart_defaults = { 'app_id': '855471ae-ece0-41bb-88cb-de2cc967bb5f', 'app_secret': 'FiYefhrSv0wkDE1bx7vWBkhdsTsVenVeI9z9P', 'api_base': 'http://localhost:8080/cpcds-server/fhir', 'redirect_uri': 'http://localhost:8000/fhir-app/', }

I then attempt to authorize at http://localhost:8000. It prompts me to log in to the auth server. I log in with a registered user and get redirected to the redirect_uri (http://localhost:8000/fhir-app/) and receive an authorization code in the URL. At that point I get an Authorization Error and the flow stops.

view this post on Zulip Stephen Whitney (Apr 09 2020 at 18:46):

I understand that this is the point in the flow where I'm getting stuck:

image.png

view this post on Zulip Stephen Whitney (Apr 09 2020 at 19:07):

https://github.com/smart-on-fhir/client-py/blob/1f622d28d039ae7d60045595680b3a2aef66f473/fhirclient/auth.py#L231

The line above in auth.py correctly parses the URL with code when I test:

image.png

view this post on Zulip Stephen Whitney (Apr 09 2020 at 19:22):

I believe the issue might be that the app doesn't pass a basic Authorization header. I'll likely have to edit the code to handle.
image.png
image.png

view this post on Zulip Grahame Grieve (Apr 09 2020 at 20:29):

perhaps you might ask in the #smart stream

view this post on Zulip Stephen Whitney (Apr 09 2020 at 20:41):

Thanks @Grahame Grieve . I was successful in getting it to work!
image.png

view this post on Zulip Tushar (May 07 2020 at 21:03):

Hello, I have question can we use third party authorization server like OKTA instead of CPCDS auth server?


Last updated: Apr 12 2022 at 19:14 UTC