Redirect uri custom schema

201 views
Skip to first unread message

Oleksiy Kononenko

unread,
Mar 1, 2018, 4:50:49 PM3/1/18
to Cerner FHIR Developers
I am working on a native standalone application for our doctors for internal use and i do not know what to set as my callback URL. I tried to use my custom schema `myclinicalviewer://` in fhir cerner console and my app got created https://code.cerner.com/developer/smart-on-fhir/apps/5f3100a1-d587-4aab-895b-bb05d1c8070a but now i can't update that url  because i am getting an error : Error! Failed to modify your SMART app. Please try again!

Is it a limitation of current platform? If so what should i put as redirect url back to my native app from Oauth2 workflow?


Kol Kheang (Cerner)

unread,
Mar 1, 2018, 5:28:15 PM3/1/18
to Cerner FHIR Developers
Hi Oleksiy,

This is not a valid scheme.  You'll need to put something else after the // part.  Please see this section 

Native Client Applications on Mobile Platforms from http://fhir.cerner.com/authorization/#requesting-authorization-on-behalf-of-a-system.

Ideally, it should be something similar to sample.application://callback.

Thanks,
Kol

Oleksiy Kononenko

unread,
Mar 1, 2018, 9:34:08 PM3/1/18
to Cerner FHIR Developers
I made progress finally. I am now able to get `authorization_code` redirected back to my application. Basically in native iOS app i open a webview in separate view that walks user thru Oath2 flow. If Authorization is successful webview redirects back to my app with using custom scheme that I defined with code parameter appended to redirect uri. The application then receives that url and i can parse out the needed code. 
However when i try to request an access token i get an error redirect URI is invalid. I do not get how it is possible because i get past first phase and receive authorization code:


curl -X POST \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'code=e87abbee-4831-4893-bbcc-03144c30204c&state=120d4e4b-91ef-1e55-de83-bbb2ed9a3b4f&client_id=d1214878-f40b-4eed-a312-345c92d07876&grant_type=authorization_code'​

Here is the Error:

"NativeApp" was attempting to request access to healthcare data with FHIR Play Millennium; unfortunately, the application doesnt appear to be compatible. If you require further assistance, please contact support.

Information to provide to Technical Support

Correlation ID
f7b9b7a8-707d-43f8-a08a-27bfabfb2307

Information to provide to NativeApp

The URI provided did not match the original request, or is not a valid URI.

Error Code
urn:cerner:error:authorization-server:oauth2:token:code-invalid-redirect-uri

Oleksiy Kononenko

unread,
Mar 2, 2018, 12:55:25 PM3/2/18
to Cerner FHIR Developers
Can anyone point me to right direction here? Thanks a lot

Hank DeDona

unread,
Mar 2, 2018, 1:13:55 PM3/2/18
to Cerner FHIR Developers
From what I'm seeing here, the error seems to specify that the redirect URI doesn't match. From what I can tell, your token request does not include a redirect_uri, but if you provided a redirect URI upon the authorization request then you must provide a redirect_uri upon the token request as per the spec [1]

Oleksiy Kononenko

unread,
Mar 5, 2018, 3:55:16 PM3/5/18
to Cerner FHIR Developers
That was it! thanks a lot. 
Reply all
Reply to author
Forward
0 new messages