invalid_client error on ROR

110 views
Skip to first unread message

pawan chawda

unread,
Mar 30, 2021, 6:04:46 AM3/30/21
to SMART on FHIR
Hi

I am new on Smart on FHIR. I need to integrate FHIR with rails. I found a gem fhir_client on smarthealth.org. Here in this code "client = FHIR::Client.new(url)" used url but I unable to find it. I used this 'https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4' url for code. I made account on https://fhir.epic.com. I created an application in sanbox mode.

Here is code for authentication

client = FHIR::Client.new(url)
client_id = 'example'
client_secret = 'secret'
options = client.get_oauth2_metadata_from_conformance
if options.empty?
  puts 'This server does not support the expected OAuth2 extensions.'
else
  client.set_oauth2_auth(client_id, client_secret, options[:authorize_url] ,options[:token_url], options[:site])
end

I used Non-Production Client ID and secrets.

I got error Invalid client. I don't know where I am doing wrong. If I aceess patient create api I got 401 error.

Thanks & Regard
Pawan
Reply all
Reply to author
Forward
0 new messages