Closed dattachandan closed 1 year ago
Going though the entire launch auth flow step-by-step:
Launch This is the action of clicking on the "Launch" button in the SMART Launcher. It launches the app.
Get auth server
The app initially doesn't know the location of the auth server, so it has to request the auth server's endpoint from the CMS server. In this case it is a GET request:
https://launch.smarthealthit.org/v/r4/fhir/.well-known/smart-configuration
In the response, auth server endpoint is defined as https://launch.smarthealthit.org/v/r4/auth
. The app now knows where to go to be authenticated.
Request authorisation
Now, since the app knows where to be authenticated, it asks the browser to navigate to the auth server's authorize endpoint to get an authorization code. In this case:
https://launch.smarthealthit.org/v/r4/auth/authorize
This navigation request consists of all the launch params defined in the first step i.e. client id, scopes, redirect uri, etc. If the auth server accepts this request, it generates an authorization code.
Redirect to app If an authorization code is generated, the user is redirected back to the app with the authorization code. Otherwise, you get blocked from proceeding further. A page showing "unauthorised" might be shown along with the reasons why you aren't authorised (possibly due to mismatched scopes or a client id).
Token exchange
Now that the app has an authorization code, it performs a POST request to the auth server's token endpoint to trade its authorization code for an access token. In this case:
https://launch.smarthealthit.org/v/r4/auth/token
This access token can now be used when making requests to the CMS's FHIR API.
Here's where the steps fit In your screenshot:
Hope that helps.
Hey @dattachandan, are you happy for me to close this issue given it has been stale for a bit?
While launching the smartform.io from the smarthealthit launcher using provider and patient context, where does the app get the /token from? Why is the app following a Auth code flow (authorisation_code) as well?
Also confirming if this is the implemented flow for establishing the provider and patient context? is the /auth token call for this highlighted step?