Swagger authorize button seems to generate incorrect url

Hi. I’m trying to get the SMART on FHIR stuff working. I can register the swagger app and launch it from a patient’s dashboard. I then click the Authorize button, which brings up the Available Authorizations page
That page shows the authorization url to be /oauth2/default/authorize
When I click Authorize on that page, I get a 404, with the browser trying to open
If I change this to
I then get
{“error”:“invalid_client”,“error_description”:“Client authentication failed”,“message”:“Client authentication failed”}
which seems like progress (and a different issue maybe)

Why is the url being generated to reach the authorize service missing “openemr”?
I tried setting Site Address Override (if needed for OAuth2, FHIR, CCDA, or Payment Processing) in Admin | globals | connectors to various possibilities, and closing all browsers and restarting apache, but none affected this issue

I got https working by making a self-signed cert using makecert.bat in xamp apache conf (I didn’t use the openemr admin | system | certificates page). Is that the issue?


openemr v 7.0.0 (1)
xampp 3.3.0 running on windows server 2022 datacenter (in AWS)
running in Edge

In apache log, I do see this. Not sure if relevant:
www.example.com:443:0 server certificate does NOT include an ID which matches the server name
Nothing of interest in php_error log

I’ve gotten a bit farther on this
I realized I was not entering the right client_id value on the Available Authorizations page (my browser was autofilling in my openemr userid, which was inappropriate).
When I enter the proper client_id and client_secret for the swagger registration I did in admin | system | api clients, and click Authorize at the bottom of the page, I again get taken to https://{site name}/oauth2/default/authorize and get a 404 error.
If I change this to https://{site name}/openemr/oauth2/default/authorize, I get taken to the Sign In page. I log in with openemr credentials and get taken to an “Authorizing for Application swagger confidential” page. I select my scope of interest (allergy/intollerance: read access) and click Authorize. I sometimes get asked to select a patient from my available patients. I then am taken back to the Available Authorizations page, with an error message displayed of “Auth ErrorError: Not Found”. There is nothing in php_errors_log.
So I still have the improper url being constructed (missing “openemr”), but can now get passed that.
But I don’t know what to make of this final error.
Back on the main swagger page, if I try to try out the /fhir/AllergyIntollerance item, I see that the url it is trying to open is
https://{site name}/apis/default/fhir/AllergyIntolerance
I assume this is similarly missing the “openemr” in the url, and is failing as a consequence

I tried out the demo openemr site and was able to successfully register swagger as an api client, and get a fhir query to work in the swagger app. I note that the url used to reach oauth/default/authorize includes “openemr” in the url in the demo system, so it seems valid for the path to the oauth and apis pages in my system to include “openemr” in the url.

Ok, found it
Had to edit openemr\swagger\openemr-api.yaml
Search for “oauth2”
and edited, adding “openemr”, so it looked like this:
authorizationUrl: /openemr/oauth2/default/authorize
tokenUrl: /openemr/oauth2/default/token
refreshUrl: /openemr/oauth2/default/token
Also, edited this line at the top of the file, adding “openemr”
url: /openemr/apis/default/