So I’ve been using the endpoints for OpenEMR only for user_role=users.
Recently I’ve enabled Patient Portal and created credentials for one patient.
I’m trying to receive an access token using the following endpoint:
POST:http://192.168.1.10:8300/oauth2/default/token
H: Content-Type: application/x-www-form-urlencoded
B: grant_type: password
client_id: JEe4Ja5yh3P9E0kGOv5tGOhtllKK0LSJqopbpGPs5YE
user_role: patient
username: test
password: test
email: test
scope: openid
and I get this response, even though these credentials are working in Patient Portal UI
"error": "invalid_grant",
"error_description": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.",
"hint": "Failed Authentication",
"message": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."
}
Any idea on what I’m doing wrong?
I should mention I’m just a junior developer, so in case you think “for sure it’s not that, he would have been checking that”, please reconsider and let me know about any idea.
Edited: using admin account and user_role=users works just fine
Thank you @adunsulag for the quick response. I tried both and only patient. Non of them worked, and got the same massage
{“error”:“invalid_grant”,“error_description”:“The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.”,“hint”:“Failed Authentication”,“message”:“The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.”}
Interesting is, when I changed Globals -> ‘Enable OAuth2 Password Grant (Not considered secure) to only patient, the patient portal does not work, need to do both. Does it mean, it is considering the patient as a user?