Getting internal server error, auth rest API

Hi there,

Situation
I have created a user from the admin and trying to login using the same credentials, getting 500 error while calling /apis/api/auth end point.
payload:
{
“grant_type”:“password”,
“username”: “xxxxx”,
“password”: “test123”,
“user_role”:“users”,
“scope”:“openid”
}

OpenEMR Version
I’m using OpenEMR version
v5.0.2

Browser:
I’m using: client application (e.g. postman)

Operating System
I’m using: osX

Best regards,

Hi @rhlcliffex

Have you referred this.

Regards,
ViSolve-121

thanks for your response. Could you please help me to get the site id ?

Best regards,

If you’re not using multisite the

"scope":"default"

Otherwise use your multisite site name

Thanks Jerry… it works

Hi guys,

I just looked at this thread and I kinda have the same issue.

I’m directly logged on my ubuntu machine where OpenEMR is installed and I run a very basic auth command:

Blockquote
curl -X POST -v --insecure -H ‘Content-Type: application/json’ ‘http://localhost/apis/api/auth
-d ‘{
“grant_type”:“password”,
“username”: “me”,
“password”: “mypassword”,
“user_role”:“users”,
“scope”:“default”
}’

and this is what I get back

Blockquote
Note: Unnecessary use of -X or --request, POST is already inferred.

  • Trying 127.0.0.1…
  • Connected to localhost (127.0.0.1) port 80 (#0)

POST /apis/api/auth HTTP/1.1
Host: localhost
User-Agent: curl/7.47.0
Accept: /
Content-Type: application/json
Content-Length: 142

  • upload completely sent off: 142 out of 142 bytes
    < HTTP/1.1 400 Bad Request
    < Date: Thu, 04 Feb 2021 05:46:36 GMT
    < Server: Apache
    < Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
    < X-XSS-Protection: 1; mode=block
    < Content-Length: 0
    < Connection: close
    < Content-Type: text/html; charset=UTF-8
    <
  • Closing connection 0

I verified my credentials using the main OpenEMR web interface and it works sop I’m wondering what I’m doing wrong …

Any help is greatly appreciated :slight_smile:

1 Like