Do you use or administer OpenEMR? Take the General Satisfaction Survey to help improve the product

Refresh Token not being set with offline_access during registration

I’m registering my app via: https://localhost:9300/oauth2/default/registration using postman with the following info:

{
    "application_type": "private",
    "redirect_uris": ["http://localhost:3000/launch"],
    "initiate_login_uri": "http://localhost:3000",
    "post_logout_redirect_uris": "http://localhost:3000",
    "client_name": "myapp",
    "token_endpoint_auth_method": "client_secret_post",
    "contacts": ["info@myapp.com"],
    "scope": "openid email phone address api:oemr api:fhir api:port launch launch/patient offline_access online_access"
}

This is the response:

{
    "client_id": "_9Id66Bk6KhIs3lq7EBM3OzqET8kDwGNHtzrCNyBPDk",
    "client_secret": "MnpxnIJwgPiQFDq-QcG1ayqtGrwKEvgnv0WE48b_OoiM0gTs7wZa-PE0vciuvYppXtKuOGuNqVKDmC2TX5xPKA",
    "registration_access_token": "6z4tpRX9ZovrUf3I1WOk4z0QTx-sGYgFsASwtQpJKnY",
    "registration_client_uri": "https://localhost:9300/oauth2/default/client/Ib-lvZPaGckAu3spm_Ha1A",
    "client_id_issued_at": 1616510657,
    "client_secret_expires_at": 0,
    "client_role": "user",
    "contacts": [
        "info@nowhere.com"
    ],
    "application_type": "private",
    "client_name": "ERsight",
    "redirect_uris": [
        "http://localhost:3000/launch"
    ],
    "post_logout_redirect_uris": null,
    "token_endpoint_auth_method": "client_secret_post",
    "initiate_login_uri": "http://localhost:3000",
    "scope": "openid email phone address api:oemr api:fhir api:port launch launch/patient offline_access online_access"
}

As you can see there is no refresh token being returned, what am I missing?

Thanks.

Ok so the only thing on display here is my stupidity :rofl:

You get your refresh_token when you login/authorize your app or at least that’s what I think since I can get the refresh_token if I login using the password grant flow.

What I don’t quite understand yet is how to login using the Authorization Code Grant flow, the example on the API docs is most likely incomplete or wrong since it makes it seem like you would use the refresh token flow to perform the auth.

So my question is how do you get a refresh token when using the authorization code grant flow.

Thanks.

Are you requesting the offline_access scope? Refresh Token is only supposed to go out if you request the offline_access scope.

http://www.hl7.org/fhir/smart-app-launch/#step-5-later-app-uses-a-refresh-token-to-obtain-a-new-access-token

Yeah, it’s in the scope access being requested in the post example, that is what I’m using to register and the response never includes a refresh token.

umm when registering an app, the registration access token is only token returned to be stored for client info update/requests in future. Scopes in registration are available scopes the client is authorized to use in api requests.
Ya won’t get a refresh until auth server sign in. Or am I missing something?

So how would I auth?

The only example in the API is for Refresh Token:

curl -X POST -k -H 'Content-Type: application/x-www-form-urlencoded'
-i 'https://localhost:9300/oauth2/default/token'
--data 'grant_type=refresh_token
&client_id=LnjqojEEjFYe5j2Jp9m9UnmuxOnMg4VodEJj3yE8_OA
&refresh_token=def5020089a766d16...'

I’ve tried: https://localhost:443/oauth2/default/authorize as my API endpoint with these values as urlencoded form

response_type:code
client_id:myClientID
scope:openid email phone address api:oemr api:fhir api:port launch launch/patient offline_access online_access
client_secret:myClientSecret
grant_type:authorization_code

That just gives me a 500 error.

Apache error log:

[Thu Mar 25 16:35:27.691620 2021] [ssl:warn] [pid 126] AH01906: 192.168.224.3:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu Mar 25 16:35:27.691632 2021] [ssl:warn] [pid 126] AH01909: 192.168.224.3:443:0 server certificate does NOT include an ID which matches the server name
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.224.3. Set the 'ServerName' directive globally to suppress this message
[Thu Mar 25 16:35:27.703221 2021] [ssl:warn] [pid 126] AH01906: 192.168.224.3:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu Mar 25 16:35:27.703230 2021] [ssl:warn] [pid 126] AH01909: 192.168.224.3:443:0 server certificate does NOT include an ID which matches the server name
[Thu Mar 25 16:35:27.704730 2021] [mpm_prefork:notice] [pid 126] AH00163: Apache/2.4.46 (Unix) OpenSSL/1.1.1j configured -- resuming normal operations
[Thu Mar 25 16:35:27.704744 2021] [core:notice] [pid 126] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Mar 25 17:03:28.712485 2021] [php7:error] [pid 128] [client 192.168.224.1:53488] PHP Fatal error:  Uncaught Error: Class 'HttpRestRequest' not found in /var/www/localhost/htdocs/openemr/apis/dispatch.php:29\nStack trace:\n#0 {main}\n  thrown in /var/www/localhost/htdocs/openemr/apis/dispatch.php on line 29, referer: http://localhost:3000/
[Thu Mar 25 17:03:28.713269 2021] [php7:error] [pid 131] [client 192.168.224.1:53486] PHP Fatal error:  Uncaught Error: Class 'HttpRestRequest' not found in /var/www/localhost/htdocs/openemr/apis/dispatch.php:29\nStack trace:\n#0 {main}\n  thrown in /var/www/localhost/htdocs/openemr/apis/dispatch.php on line 29, referer: http://localhost:3000/
[Thu Mar 25 17:24:39.382913 2021] [ssl:warn] [pid 16] AH01906: 192.168.224.3:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu Mar 25 17:24:39.382926 2021] [ssl:warn] [pid 16] AH01909: 192.168.224.3:443:0 server certificate does NOT include an ID which matches the server name
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.224.3. Set the 'ServerName' directive globally to suppress this message
[Thu Mar 25 17:24:39.395312 2021] [ssl:warn] [pid 16] AH01906: 192.168.224.3:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu Mar 25 17:24:39.395324 2021] [ssl:warn] [pid 16] AH01909: 192.168.224.3:443:0 server certificate does NOT include an ID which matches the server name
[Thu Mar 25 17:24:39.395414 2021] [core:warn] [pid 16] AH00098: pid file /run/apache2/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Mar 25 17:24:39.396840 2021] [mpm_prefork:notice] [pid 16] AH00163: Apache/2.4.46 (Unix) OpenSSL/1.1.1j configured -- resuming normal operations
[Thu Mar 25 17:24:39.396860 2021] [core:notice] [pid 16] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Mar 25 17:27:57.853651 2021] [php7:error] [pid 24] [client 192.168.224.1:53974] PHP Fatal error:  Uncaught Error: Class 'HttpRestRequest' not found in /var/www/localhost/htdocs/openemr/apis/dispatch.php:29\nStack trace:\n#0 {main}\n  thrown in /var/www/localhost/htdocs/openemr/apis/dispatch.php on line 29, referer: http://localhost:3000/
[Thu Mar 25 17:27:57.854716 2021] [php7:error] [pid 25] [client 192.168.224.1:53978] PHP Fatal error:  Uncaught Error: Class 'HttpRestRequest' not found in /var/www/localhost/htdocs/openemr/apis/dispatch.php:29\nStack trace:\n#0 {main}\n  thrown in /var/www/localhost/htdocs/openemr/apis/dispatch.php on line 29, referer: http://localhost:3000/
[Thu Mar 25 17:33:48.380008 2021] [php7:error] [pid 18] [client 192.168.224.1:54098] PHP Fatal error:  Uncaught Error: Class 'HttpRestRequest' not found in /var/www/localhost/htdocs/openemr/apis/dispatch.php:29\nStack trace:\n#0 {main}\n  thrown in /var/www/localhost/htdocs/openemr/apis/dispatch.php on line 29, referer: http://localhost:3000/
[Thu Mar 25 17:33:48.380008 2021] [php7:error] [pid 20] [client 192.168.224.1:54100] PHP Fatal error:  Uncaught Error: Class 'HttpRestRequest' not found in /var/www/localhost/htdocs/openemr/apis/dispatch.php:29\nStack trace:\n#0 {main}\n  thrown in /var/www/localhost/htdocs/openemr/apis/dispatch.php on line 29, referer: http://localhost:3000/
[Thu Mar 25 17:51:09.261204 2021] [php7:error] [pid 17] [client 192.168.224.1:54374] PHP Fatal error:  Uncaught Error: Class 'OpenEMR\\RestControllers\\Psr17Factory' not found in /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php:358\nStack trace:\n#0 /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php(108): OpenEMR\\RestControllers\\AuthorizationController->createServerResponse()\n#1 /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php(101): OpenEMR\\RestControllers\\AuthorizationController->configKeyPairs()\n#2 /var/www/localhost/htdocs/openemr/oauth2/authorize.php(69): OpenEMR\\RestControllers\\AuthorizationController->__construct()\n#3 {main}\n  thrown in /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php on line 358
[Thu Mar 25 17:53:38.937057 2021] [php7:error] [pid 17] [client 192.168.224.1:54422] PHP Fatal error:  Uncaught Error: Class 'OpenEMR\\RestControllers\\Psr17Factory' not found in /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php:358\nStack trace:\n#0 /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php(108): OpenEMR\\RestControllers\\AuthorizationController->createServerResponse()\n#1 /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php(101): OpenEMR\\RestControllers\\AuthorizationController->configKeyPairs()\n#2 /var/www/localhost/htdocs/openemr/oauth2/authorize.php(69): OpenEMR\\RestControllers\\AuthorizationController->__construct()\n#3 {main}\n  thrown in /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php on line 358
[Thu Mar 25 17:53:56.826001 2021] [php7:error] [pid 25] [client 192.168.224.1:54442] PHP Fatal error:  Uncaught Error: Class 'OpenEMR\\RestControllers\\Psr17Factory' not found in /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php:358\nStack trace:\n#0 /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php(108): OpenEMR\\RestControllers\\AuthorizationController->createServerResponse()\n#1 /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php(101): OpenEMR\\RestControllers\\AuthorizationController->configKeyPairs()\n#2 /var/www/localhost/htdocs/openemr/oauth2/authorize.php(69): OpenEMR\\RestControllers\\AuthorizationController->__construct()\n#3 {main}\n  thrown in /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php on line 358
[Thu Mar 25 17:54:09.326466 2021] [php7:error] [pid 26] [client 192.168.224.1:54462] PHP Fatal error:  Uncaught Error: Class 'OpenEMR\\RestControllers\\Psr17Factory' not found in /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php:358\nStack trace:\n#0 /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php(108): OpenEMR\\RestControllers\\AuthorizationController->createServerResponse()\n#1 /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php(101): OpenEMR\\RestControllers\\AuthorizationController->configKeyPairs()\n#2 /var/www/localhost/htdocs/openemr/oauth2/authorize.php(69): OpenEMR\\RestControllers\\AuthorizationController->__construct()\n#3 {main}\n  thrown in /var/www/localhost/htdocs/openemr/src/RestControllers/AuthorizationController.php on line 358

Keep in mind I am using a fork of master, not a stable release.

I’m not sure about smart but normally one would use one or the other, offline or online.
Second issue, it appears to me, is your certificate(public/private) are using the wrong keys for decryption.
This can happen when moving DB and/or site content around in testing.

  • delete your sites/default/documents/certificates/oaprivate.key and oapublic.key
  • delete from table keys the oauth2… entries

now try to auth

Ok so treat me like I’m a dumb person, how would I auth using client_id and client_secret once I’ve registered my smart app, what does that curl look like?

Because right now I don’t know if I’m doing something wrong or I’m encountering a bug, thanks.

@sjpadgett I did as you suggested deleting the certs and removing the entries from the DB and now I can’t register an app or auth.

Apache error log for context:

[Sat Mar 27 14:03:14.012973 2021] [php7:notice] [pid 17] [client 172.27.0.1:44040] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/timeout_iframe.php
[Sat Mar 27 14:03:17.755740 2021] [php7:notice] [pid 17] [client 172.27.0.1:44040] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:03:17.756698 2021] [php7:notice] [pid 18] [client 172.27.0.1:44058] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:03:17.947561 2021] [php7:notice] [pid 17] [client 172.27.0.1:44040] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:03:17.947681 2021] [php7:notice] [pid 17] [client 172.27.0.1:44040] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:03:18.037704 2021] [php7:notice] [pid 18] [client 172.27.0.1:44058] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:03:18.037857 2021] [php7:notice] [pid 18] [client 172.27.0.1:44058] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:03:18.037967 2021] [php7:notice] [pid 18] [client 172.27.0.1:44058] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:03:24.760484 2021] [php7:notice] [pid 28] [client 172.27.0.1:44092] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/messages/messages.php?form_active=1
[Sat Mar 27 14:04:18.749186 2021] [php7:notice] [pid 29] [client 172.27.0.1:44102] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:04:18.749862 2021] [php7:notice] [pid 20] [client 172.27.0.1:44108] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:04:18.936189 2021] [php7:notice] [pid 20] [client 172.27.0.1:44108] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:04:18.936324 2021] [php7:notice] [pid 20] [client 172.27.0.1:44108] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:04:18.936443 2021] [php7:notice] [pid 20] [client 172.27.0.1:44108] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:04:18.937276 2021] [php7:notice] [pid 29] [client 172.27.0.1:44102] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:04:18.937409 2021] [php7:notice] [pid 29] [client 172.27.0.1:44102] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:04:25.755132 2021] [php7:notice] [pid 23] [client 172.27.0.1:44142] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/messages/messages.php?form_active=1
[Sat Mar 27 14:05:14.754766 2021] [php7:notice] [pid 30] [client 172.27.0.1:44152] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/timeout_iframe.php
[Sat Mar 27 14:05:15.025986 2021] [php7:notice] [pid 30] [client 172.27.0.1:44152] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/timeout_iframe.php
[Sat Mar 27 14:05:15.026124 2021] [php7:notice] [pid 30] [client 172.27.0.1:44152] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/timeout_iframe.php
[Sat Mar 27 14:05:18.250133 2021] [php7:notice] [pid 27] [client 172.27.0.1:44176] [2021-03-27T14:05:18.249534+00:00] OpenEMR.ERROR: OpenEMR error - oauth2 passphrase is missing, so forced exit [] []
[Sat Mar 27 14:05:18.748888 2021] [php7:notice] [pid 30] [client 172.27.0.1:44152] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:05:18.749719 2021] [php7:notice] [pid 38] [client 172.27.0.1:44184] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:05:18.939831 2021] [php7:notice] [pid 30] [client 172.27.0.1:44152] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:05:18.939958 2021] [php7:notice] [pid 30] [client 172.27.0.1:44152] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:05:19.029966 2021] [php7:notice] [pid 38] [client 172.27.0.1:44184] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:05:19.030103 2021] [php7:notice] [pid 38] [client 172.27.0.1:44184] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:05:19.030203 2021] [php7:notice] [pid 38] [client 172.27.0.1:44184] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:05:26.754101 2021] [php7:notice] [pid 17] [client 172.27.0.1:44218] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/messages/messages.php?form_active=1
[Sat Mar 27 14:06:00.821310 2021] [ssl:warn] [pid 16] AH01906: 172.27.0.6:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Sat Mar 27 14:06:00.821323 2021] [ssl:warn] [pid 16] AH01909: 172.27.0.6:443:0 server certificate does NOT include an ID which matches the server name
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.27.0.6. Set the 'ServerName' directive globally to suppress this message
[Sat Mar 27 14:06:00.833025 2021] [ssl:warn] [pid 16] AH01906: 172.27.0.6:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Sat Mar 27 14:06:00.833034 2021] [ssl:warn] [pid 16] AH01909: 172.27.0.6:443:0 server certificate does NOT include an ID which matches the server name
[Sat Mar 27 14:06:00.833122 2021] [core:warn] [pid 16] AH00098: pid file /run/apache2/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sat Mar 27 14:06:00.834387 2021] [mpm_prefork:notice] [pid 16] AH00163: Apache/2.4.46 (Unix) OpenSSL/1.1.1j configured -- resuming normal operations 
[Sat Mar 27 14:06:00.834406 2021] [core:notice] [pid 16] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Sat Mar 27 14:06:06.734290 2021] [php7:notice] [pid 17] [client 172.27.0.1:44232] [2021-03-27T14:06:06.733713+00:00] OpenEMR.ERROR: OpenEMR error - oauth2 passphrase is missing, so forced exit [] []
[Sat Mar 27 14:06:27.752110 2021] [php7:notice] [pid 19] [client 172.27.0.1:44242] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/messages/messages.php?form_active=1
[Sat Mar 27 14:07:04.755440 2021] [php7:notice] [pid 21] [client 172.27.0.1:44260] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:07:04.755445 2021] [php7:notice] [pid 20] [client 172.27.0.1:44258] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:07:04.967114 2021] [php7:notice] [pid 20] [client 172.27.0.1:44258] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:07:04.967305 2021] [php7:notice] [pid 20] [client 172.27.0.1:44258] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:07:04.967419 2021] [php7:notice] [pid 20] [client 172.27.0.1:44258] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:07:04.969185 2021] [php7:notice] [pid 21] [client 172.27.0.1:44260] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:07:04.969335 2021] [php7:notice] [pid 21] [client 172.27.0.1:44260] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/main.php?token_main=XnqNh5RYnQpmPIVSIqa9wBHbdbDsCi7xDbL4pqG3
[Sat Mar 27 14:07:15.755046 2021] [php7:notice] [pid 18] [client 172.27.0.1:44298] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/timeout_iframe.php
[Sat Mar 27 14:07:16.035139 2021] [php7:notice] [pid 18] [client 172.27.0.1:44298] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/timeout_iframe.php
[Sat Mar 27 14:07:16.035280 2021] [php7:notice] [pid 18] [client 172.27.0.1:44298] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/tabs/timeout_iframe.php
[Sat Mar 27 14:07:28.755186 2021] [php7:notice] [pid 17] [client 172.27.0.1:44318] Xdebug: [Step Debug] Could not connect to debugging client. Tried: 
172.27.0.1:9003 (from REMOTE_ADDR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost:8300/interface/main/messages/messages.php?form_active=1

So here’s what I’ve tried so far.

I modified SmartLaunchController.php with the following:

<?php foreach ($smartClients as $client) : ?>
                        <li class="summary_item">
                            <button class='btn btn-primary btn-sm smart-launch-btn' data-smart-name="<?php echo attr($client->getName()); ?>" data-smart-redirect-url="<?php echo attr($client->getLaunchUri($launchParams)); ?>">
                                <?php echo xlt("Launch"); ?>
                            </button>
                            <?php echo text($client->getName()); ?>
                        </li>
                        <li>
                            <a href="<?php echo attr($client->getLaunchUri($launchParams)); ?>"> Launch <?php echo text($client->getName()); ?></a>
                        </li>
                    <?php endforeach; ?>

When I click the regular button that opens the link in an iFrame I get these errors:

VM20015 0.chunk.js:4564 GET https://localhost:9300/apis/default/fhir/.well-known/smart-configuration net::ERR_CERT_AUTHORITY_INVALID
(anonymous) @ VM20015 0.chunk.js:4564
fetch @ VM20015 0.chunk.js:4501
request @ VM20015 0.chunk.js:25265
getAndCache @ VM20015 0.chunk.js:25341
fetchWellKnownJson @ VM20015 0.chunk.js:25819
getSecurityExtensionsFromWellKnownJson @ VM20015 0.chunk.js:25830
getSecurityExtensions @ VM20015 0.chunk.js:25931
authorize @ VM20015 0.chunk.js:26119
async function (async)
authorize @ VM20015 0.chunk.js:26066
authorize @ VM20015 0.chunk.js:25047
(anonymous) @ VM20016 main.chunk.js:3077
invokePassiveEffectCreate @ VM20015 0.chunk.js:62340
callCallback @ VM20015 0.chunk.js:42956
invokeGuardedCallbackDev @ VM20015 0.chunk.js:43005
invokeGuardedCallback @ VM20015 0.chunk.js:43065
flushPassiveEffectsImpl @ VM20015 0.chunk.js:62422
unstable_runWithPriority @ VM20015 0.chunk.js:73900
runWithPriority$1 @ VM20015 0.chunk.js:50362
flushPassiveEffects @ VM20015 0.chunk.js:62299
(anonymous) @ VM20015 0.chunk.js:62180
workLoop @ VM20015 0.chunk.js:73844
flushWork @ VM20015 0.chunk.js:73800
performWorkUntilDeadline @ VM20015 0.chunk.js:73404
VM20015 0.chunk.js:4564 GET https://localhost:9300/apis/default/fhir/metadata net::ERR_CERT_AUTHORITY_INVALID
(anonymous) @ VM20015 0.chunk.js:4564
fetch @ VM20015 0.chunk.js:4501
request @ VM20015 0.chunk.js:25265
getAndCache @ VM20015 0.chunk.js:25341
fetchConformanceStatement @ VM20015 0.chunk.js:25359
getSecurityExtensionsFromConformanceStatement @ VM20015 0.chunk.js:25848
getSecurityExtensions @ VM20015 0.chunk.js:25936
authorize @ VM20015 0.chunk.js:26119
async function (async)
authorize @ VM20015 0.chunk.js:26066
authorize @ VM20015 0.chunk.js:25047
(anonymous) @ VM20016 main.chunk.js:3077
invokePassiveEffectCreate @ VM20015 0.chunk.js:62340
callCallback @ VM20015 0.chunk.js:42956
invokeGuardedCallbackDev @ VM20015 0.chunk.js:43005
invokeGuardedCallback @ VM20015 0.chunk.js:43065
flushPassiveEffectsImpl @ VM20015 0.chunk.js:62422
unstable_runWithPriority @ VM20015 0.chunk.js:73900
runWithPriority$1 @ VM20015 0.chunk.js:50362
flushPassiveEffects @ VM20015 0.chunk.js:62299
(anonymous) @ VM20015 0.chunk.js:62180
workLoop @ VM20015 0.chunk.js:73844
flushWork @ VM20015 0.chunk.js:73800
performWorkUntilDeadline @ VM20015 0.chunk.js:73404
VM20015 0.chunk.js:25906 Uncaught (in promise) Error: Failed to fetch the well-known json "https://localhost:9300/apis/default/fhir/.well-known/smart-configuration". Network request failed; Failed to fetch the conformance statement from "https://localhost:9300/apis/default/fhir/metadata". TypeError: Network request failed
    at onError (VM335 0.chunk.js:25906)

Uncaught DOMException: Blocked a frame with origin "http://localhost:8300" from accessing a cross-origin frame.
    at SizeModaliFrame (http://localhost:8300/library/dialog.js?v=62:803:118)
    at http://localhost:8300/library/dialog.js?v=62:583:29

When I use my regular link I don’t get the iframe error but I continue to get these errors:

VM20015 0.chunk.js:4564 GET https://localhost:9300/apis/default/fhir/.well-known/smart-configuration net::ERR_CERT_AUTHORITY_INVALID
(anonymous) @ VM20015 0.chunk.js:4564
fetch @ VM20015 0.chunk.js:4501
request @ VM20015 0.chunk.js:25265
getAndCache @ VM20015 0.chunk.js:25341
fetchWellKnownJson @ VM20015 0.chunk.js:25819
getSecurityExtensionsFromWellKnownJson @ VM20015 0.chunk.js:25830
getSecurityExtensions @ VM20015 0.chunk.js:25931
authorize @ VM20015 0.chunk.js:26119
async function (async)
authorize @ VM20015 0.chunk.js:26066
authorize @ VM20015 0.chunk.js:25047
(anonymous) @ VM20016 main.chunk.js:3077
invokePassiveEffectCreate @ VM20015 0.chunk.js:62340
callCallback @ VM20015 0.chunk.js:42956
invokeGuardedCallbackDev @ VM20015 0.chunk.js:43005
invokeGuardedCallback @ VM20015 0.chunk.js:43065
flushPassiveEffectsImpl @ VM20015 0.chunk.js:62422
unstable_runWithPriority @ VM20015 0.chunk.js:73900
runWithPriority$1 @ VM20015 0.chunk.js:50362
flushPassiveEffects @ VM20015 0.chunk.js:62299
(anonymous) @ VM20015 0.chunk.js:62180
workLoop @ VM20015 0.chunk.js:73844
flushWork @ VM20015 0.chunk.js:73800
performWorkUntilDeadline @ VM20015 0.chunk.js:73404
VM20015 0.chunk.js:4564 GET https://localhost:9300/apis/default/fhir/metadata net::ERR_CERT_AUTHORITY_INVALID
(anonymous) @ VM20015 0.chunk.js:4564
fetch @ VM20015 0.chunk.js:4501
request @ VM20015 0.chunk.js:25265
getAndCache @ VM20015 0.chunk.js:25341
fetchConformanceStatement @ VM20015 0.chunk.js:25359
getSecurityExtensionsFromConformanceStatement @ VM20015 0.chunk.js:25848
getSecurityExtensions @ VM20015 0.chunk.js:25936
authorize @ VM20015 0.chunk.js:26119
async function (async)
authorize @ VM20015 0.chunk.js:26066
authorize @ VM20015 0.chunk.js:25047
(anonymous) @ VM20016 main.chunk.js:3077
invokePassiveEffectCreate @ VM20015 0.chunk.js:62340
callCallback @ VM20015 0.chunk.js:42956
invokeGuardedCallbackDev @ VM20015 0.chunk.js:43005
invokeGuardedCallback @ VM20015 0.chunk.js:43065
flushPassiveEffectsImpl @ VM20015 0.chunk.js:62422
unstable_runWithPriority @ VM20015 0.chunk.js:73900
runWithPriority$1 @ VM20015 0.chunk.js:50362
flushPassiveEffects @ VM20015 0.chunk.js:62299
(anonymous) @ VM20015 0.chunk.js:62180
workLoop @ VM20015 0.chunk.js:73844
flushWork @ VM20015 0.chunk.js:73800
performWorkUntilDeadline @ VM20015 0.chunk.js:73404
VM20015 0.chunk.js:25906 Uncaught (in promise) Error: Failed to fetch the well-known json "https://localhost:9300/apis/default/fhir/.well-known/smart-configuration". Network request failed; Failed to fetch the conformance statement from "https://localhost:9300/apis/default/fhir/metadata". TypeError: Network request failed
    at onError (VM335 0.chunk.js:25906)

In my launch uri in open emr I have this url which is a page to my app: http://localhost:3000/launch

Which has this setup in order to test if the integration and get the selected patient data.

So what I’m trying to do is get the info of the selected patient in Open EMR and display his data in my app when you click the launch button in Open EMR.

This is why I continue asking how do you auth using a client_id and client_secret because once I can do this I think I can figure out how to get this working.

Thanks.

let’s just talk about on call today. I’ll be there. for now i’m turned around.

Sounds good if you get on a PC I can share my screen during the call, thanks.

For smaert we need @adunsulag there.

@benmarte
I merged my new portal stuff. Do you want to test and maybe see if there are still concerns you had from your PR? Restructure portal, add template categories and bugs by sjpadgett · Pull Request #4303 · openemr/openemr · GitHub
I think responsive works pretty well but, you may see differently…

oh and don’t forget to run sql_patch.php from browser.

1 Like

@sjpadgett I’ll look into it after the meeting I don’t want to break where I’m currently at so I can show you guys the problem I’m running into with the smart thingy.

1 Like