Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add necessary functionality to Fhir Client to handle Smart On Fhir authorization tokens #195

Closed
Gjoll opened this issue Apr 28, 2016 · 2 comments

Comments

@Gjoll
Copy link
Contributor

Gjoll commented Apr 28, 2016

The Smart on Fhir protocol requires http fhir messages to be sent with an http header["Authorization"] value that is returned from the smart on fhir server during oauth2 initialization.

There is no way that I can see to add the authorization token to the fhir client so that it is sent with the http request, and hence no way that I can see to use the fhir client with smart on fhir.

@brianpos
Copy link
Collaborator

brianpos commented Apr 28, 2016

This is the code from my Bearer authorize unit test...

FhirClient validationFhirClient = new FhirClient("https://sqlonfhir-dstu2.azurewebsites.net/fhir/");
            validationFhirClient.OnBeforeRequest += (object sender, BeforeRequestEventArgs e) =>
            {
                // Replace with a valid bearer token for this server
                e.RawRequest.Headers.Add("Authorization", "Bearer XXXXXXX");
            };

Then you can just use the API as normal.
There is no clean way of doing the SMART authentication steps, as these require a browser to do it, and depends on where you are running the client to be able to do it.
I've been considering writing a couple of samples that do this in WPF

@Gjoll
Copy link
Contributor Author

Gjoll commented Apr 29, 2016

Brian - Many thx. That looks like what I am looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants