client-js icon indicating copy to clipboard operation
client-js copied to clipboard

How to use in mobile app

Open quintonn opened this issue 4 years ago • 4 comments

How can the fhir client be used in a mobile app, when using a framework like apache cordova??

When using the fhir client and have a patient/clinician login, there needs to be a redirect URL. But if it is running in a mobile app, what can the redirect URL be, or is there another way to log a user in using username+password with the FHIR client?

quintonn avatar Jan 20 '21 10:01 quintonn

I have never done it myself but I know that people are successfully using app-claimed URLs - https://www.oauth.com/oauth2-servers/redirect-uris/redirect-uris-native-apps/

vlad-ignatov avatar Feb 09 '21 15:02 vlad-ignatov

Yes, I've seen that page too. Since that is oauth2's page, one would think it would have links or more information on the subject. Who else would have information on oauth2, besides oauth2 themselves?

quintonn avatar Feb 12 '21 15:02 quintonn

For posterity, this is the documentation I know of: Platform-specific link association: Android, iOS, Windows, and other platforms have introduced a method by which a native app can claim an HTTPS redirect URL, demonstrate ownership of that URL, and instruct the OS to invoke the app when that specific HTTPS URL is navigated to. Apple's iOS calls this feature "Universal Links"; Android, "App Links"; Windows, "App URI Handlers". This association of an HTTPS URL to native app is platform-specific and only available on some platforms.

madaster97 avatar Apr 14 '22 14:04 madaster97

Oh, and the AppAuth SDK for electron apps functions more like the server-side implementation of this library:

  1. Construct the authorize request URL, cache the state
  2. Open a localhost http server to listen for the redirect
  3. Open the authorize request in the system default browser
  4. Receive the auth code and state on the localhost redirect

madaster97 avatar Apr 14 '22 14:04 madaster97