Cannot access SMART on FHIR APP due to invalid client registration

Basically, this is the error:

[Fri Nov 24 10:30:01.546066 2023] [php:notice] [pid 46] [client 172.18.0.1:53570] [2023-11-24T10:30:01.545995+00:00] 
OpenEMR.ERROR: AuthorizationController->oauthAuthorizationFlow() OAuthServerException 
{"hint":"","message":"Client authentication failed","payload":{"error":"invalid_client","error_description":"Client authentication failed","message":"Client authentication failed"}
,"trace":"#0 /var/www/localhost/htdocs/openemr/vendor/league/oauth2-server/src/Grant/AbstractGrant.php(290): League\\\\OAuth2\\\\Server\\\\Exception\\\\OAuthServerException::invalidClient()\\n#1 /var/www/localhost/htdocs/openemr/src/Common/Auth/OpenIDConnect/Grant/CustomAuthCodeGrant.php(101): League\\\\OAuth2\\\\Server\\\\Grant\\\\AbstractGrant->validateRedirectUri()\\n#2 /var/www/localhost/htdocs/openemr/vendor/league/oauth2-server/src/Grant/AuthCodeGrant.php(281): OpenEMR\\\\Common\\\\Auth\\\\OpenIDConnect\\\\Grant\\\\CustomAuthCodeGrant->validateRedirectUri()\\n#3 /var/www/localhost/htdocs/openemr/src/Common/Auth/OpenIDConnect/Grant/CustomAuthCodeGrant.php(91): League\\\\OAuth2\\\\Server\\\\Grant\\\\AuthCodeGrant->validateAuthorizationRequest()\\n#4 /var/www/localhost/htdocs/openemr/vendor/league/oauth2-server/src/AuthorizationServer.php(163): OpenEMR\\\\Common\\\\Auth\\\\OpenIDConnect\\\\Grant\\\\CustomAuthCodeGrant->validateAuthorizationRequest()\\n#5 /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php(503): League\\\\OAuth2\\\\Server\\\\AuthorizationServer->validateAuthorizationRequest()\\n#6 /var/www/localhost/htdocs/openemr/oauth2/authorize.php(86): OpenEMR\\\\RestControllers\\\\AuthorizationController->oauthAuthorizationFlow()\\n#7 {main}","redirectUri":"","errorType":"invalid_client"} [], referer: https://localhost:9300/swagger/index.html

The API client is enabled. All the app redirect URI and app launch URI are correct, but for some reason, when I open the SMART on FHIR app from a patient’s dashboard, I get this error.

I’m trying to use Bilirubin to test a SMART App but it’s not working. I’m pretty sure this is a blunder, but I can’t see it. Any nudge would be appreciated.

This is the Bilirubin SMART App that I am trying to integrate with which I’m getting the error above.

In its bitbucket documentation, the launch URI and the redirect URI are mentioned, but for some reason, it just says invalid client. I have setup and started the server, and have registered the client in the application as well. Yet, I still get this error.

I have looked through everything and yet can’t come up with a solution for this.

Okay, figured out the solution. I checked the console and the app was passing “bilirubin_chart” as the client_id.

I changed the client_id to the registered client_id you get after registering a client. It worked.

Leaving this here so that nobody goes through 2 days straight of rage on a blunder.