Swagger Authorize Error - invalid_client


I’m trying to test a new api via swagger and i run into the following error when clicking “Authorize” after selecting all scopes.

Screenshot of Swagger on the left and post man on the right.

Not sure what im missing, but any help would be appreciated :slight_smile: Also wasn’t sure how much info to dumb into this, but am always happy to include more if needed.


Also think it’s important to note that i have enabled the api client via the app. And Globals → Connectors seems to have all the api related items checked.

Hi Jonathan if I had to guess it looks like you are missing the swagger oauth2-redirect.html uri in your redirect_uris piece. I looked in our documentation and I didn’t see a place where we had that in the documentation. I opened an issue and pull request to add that to the API documentation. You can see an example registration that I just tested against the demo machines here of what the correct redirect_uris should be: https://github.com/openemr/openemr/issues/4885

Hope that helps, post again if you continue to have issues.


That’s what it was missing. Thanks!

1 Like

Hi Stephen,

I am trying to do same concept. I am able to redirect swagger page, But after redirecting Its asking to sign-in page. I am passing openemr login cred- admin pass. I am unable to login. Can you please help me , if i am missing any thing.

Thank you in advanced.

If I had to guess, I would make sure you are working inside SSL. Right now we allow you to hit the page over HTTP but when you go to login it won’t save any of the session cookies when you go via HTTP.

For our ONC certification in the USA we had to change things so that the login only works when served over HTTPS. If you are doing this on the easy docker development environment then your url would be https://localhost:9300/ instead of http://localhost:8300/

We need to update the code so it just fails the request if its accessed over HTTP, but that’s not there yet.

As you can see in the example that @JMoore put above he is using the HTTPS endpoints.

Thank you for helping …

Hey @adunsulag ,

I have faced the same issue like @partner.Sunil.Kumar have mentioned. So i have tried it make it run on the and have changed the override address too. Then i have created a Api using the swagger Redirect url and Launch Url & working fine with the swagger.

But when i try to get data from postman it is giving me ssl certification not valid error and i cannot able to take the Access token cause of it.

If i wanted to add my own ssl key, where can i add it? what is the procedure needs to be done?

I have attached a screenshot below for your reference.

Best Regards,
Aravindh RN

SSL keys are setup just as you would with any apache/nginx setup. If you search the forum here there are lots of posts for setting up SSL for OpenEMR. I’m pretty sure the wiki has some information on this as well.

You can also import your generated certificate into your local SSL trusted store which is another way to bypass this.

Postman also has a setting for letting you disable the SSL certificate check if you are just wanting to have something to test with.

@eab there was some kind of tool you posted about that would automate this for local environments. I can’t seem to find it though, if you recall and want to chime in on this, that’d be great.

Dear @adunsulag ,

Thank you for the reply!