4 * ehr-launch-client.php Main entry point for the OpenEMR OAUTH2 / SMART client in ehr launch
5 * Allows a smart app to launch into the OpenEMR EHR in a seamless interaction
7 * @link http://www.open-emr.org
8 * @author Stephen Nielson <snielson@discoverandchange.com>
9 * @copyright Copyright (c) 2023 Discover and Change, Inc. <snielson@discoverandchange.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../globals.php");
15 use OpenEMR\Common\Acl\AccessDeniedException
;
16 use OpenEMR\Common\Csrf\CsrfInvalidException
;
17 use OpenEMR\Common\Csrf\CsrfUtils
;
18 use OpenEMR\Common\Logging\SystemLogger
;
19 use OpenEMR\FHIR\SMART\SmartLaunchController
;
21 $controller = new SmartLaunchController();
25 $intentData['appointment_id'] = $_REQUEST['appointment_id'] ??
null;
26 $controller->redirectAndLaunchSmartApp(
27 $_REQUEST['intent'] ??
null,
28 $_REQUEST['client_id'] ??
null,
29 $_REQUEST['csrf_token'] ??
null,
32 } catch (CsrfInvalidException
$exception) {
33 CsrfUtils
::csrfNotVerified();
34 } catch (AccessDeniedException
$exception) {
35 (new SystemLogger())->critical($exception->getMessage(), ["trace" => $exception->getTraceAsString()]);
37 } catch (Exception
$exception) {
38 (new SystemLogger())->error($exception->getMessage(), ["trace" => $exception->getTraceAsString()]);
39 die("Unknown system error occurred");