Difficulty Configuring API Access in OpenEMR 7.0.4 (OAuth2 / Swagger Connection Issue)

Post:

Hello everyone,

I’m having trouble configuring API access in OpenEMR 7.0.4. The instance is running in Docker, accessible through HTTP (port 8300) and HTTPS (port 9300), with a Cloudflare tunnel for secure external access.

I’ve successfully registered an OAuth2 client in the /apis/default/oauth2/registration endpoint, but when I try to authenticate through Swagger or Postman, I receive authorization errors such as:

{“error”:“access_denied”,“error_description”:“The resource owner or authorization server denied the request.”}

{“error”:“unsupported_grant_type”}

I’m trying to connect a third-party automation app (Keragon) that requires client_id, client_secret, and redirect URI to exchange tokens. However, I’m not sure which exact parameters or grant type OpenEMR expects (and whether Docker/Cloudflare might be affecting the redirect).

If anyone has successfully configured API + OAuth2 access in 7.0.4 (especially via Swagger or a third-party client), could you please share:

  1. The correct grant type and token endpoint parameters,

  2. Any required adjustments in docker-compose or php.ini,

  3. Whether HTTPS on 9300 is mandatory for OAuth2 in Docker setups.

Thank you in advance — any working example or configuration snippet would be greatly appreciated!

I developed a tool to help out new to openemr users of API’s

This looks very useful, I’ll take a look at it, thank you so much!