HealthRecordCommunity
FHIR🌏 International🏛 OpenEMREnriched

How to Connect SMART on FHIR OAuth2 Between OpenEMR and a Python Microservice

Wiring Up SMART on FHIR OAuth2 Between OpenEMR and a

OpenEMR includes a full SMART on FHIR OAuth2 server for integration with external services.

March 1, 2026OpenEMR

Summary

This article provides detailed technical steps for securely connecting a custom Python microservice to OpenEMR using the SMART on FHIR OAuth2 flow. It covers the entire process, including client registration, token introspection, and critical setup considerations like scope management and hostname resolution.

Key Players

OpenEMRSMART on FHIR

Details

This is a comprehensive technical tutorial detailing how to integrate an external AI agent (a Python FastAPI microservice) with OpenEMR 7.0.4 using SMART on FHIR OAuth2. The core mechanism relies on the standard OAuth2 Authorization Code flow for secure data access. Key steps include: first, registering the OAuth client within OpenEMR via either the Admin UI or programmatically using RFC 7591 to obtain `client_id` and `client_secret`. Second, implementing token introspection by calling the `/introspect` endpoint on every incoming request to validate the Bearer token's validity and scope. The article emphasizes the distinction between two scope families: Patient scopes (for specific patient data) and Staff scopes (for provider/admin access). Furthermore, it addresses common deployment pitfalls, such as hostname resolution issues in Docker Compose environments and CORS headaches when running locally, making it a highly practical guide for developers working with healthcare interoperability standards.

Technology Note

FHIR(Fast Healthcare Interoperability Resources)は医療データ交換の国際標準。このエントリの関連技術: SMART ON FHIR

📰
Read Original Article
dev.to

Original content copyright by respective publishers