fhir_client icon indicating copy to clipboard operation
fhir_client copied to clipboard

Unable to obtain Access Token from Authorization Code

Open Mysrt opened this issue 5 years ago • 3 comments

First off I'd like to say that i'm pretty new to FHIR and OAuth2 in general. I could very well just be missing something here.

I'm attempting to perform a SMART on FHIR launch utilizing this gem and the stated Oauth 2.0 workflow in the readme, but the readme doesn't seem like it would ever work? The launches i'm going through recommend redirecting to the authorization url provided in the initial launch, and then you will receive a request to your agreed upon redirect_uri. This redirect_uri then exchanges the code in the parameters for an access token.

This entire flow doesn't seem to be supported by the gem and i'm not sure how i'm supposed to utilize the gem to perform this. To make this work we've had to complete the auth outside of the gem, but I would still like to use the gem for ease of accessing APIs. I kind of have two questions.

  1. Am i correct in that the gem does not support a flow that involves a redirect_uri?
  2. Is there a way to initialize a client with an existing Access Token?

Mysrt avatar Dec 06 '18 23:12 Mysrt

You might find this conversation useful: https://groups.google.com/forum/#!topic/cerner-fhir-developers/rOJZodIJFGc

tute avatar Apr 17 '19 17:04 tute

@Mysrt We use both access token and OAuth flow here, maybe I can help ;) Can you share with use your implementation of this gem ?

EtienneDepaulis avatar Apr 17 '19 18:04 EtienneDepaulis

It looks from the linked conversation that the redirect_uri flow is doable with this gem using set_bearer_token but the documentation in the README seems incomplete in terms of explaining how this flow would work. Our business will likely be using this in coming months and will post a PR with more complete documentation if so.

smoyte avatar May 01 '19 16:05 smoyte