Unable to login via API (Frappe V13)

Hello,

I am trying to login to Frappe version 13 through Postman. I get the following response;

{
“message”: “Logged In”,
“home_page”: “/app”,
“full_name”: “User Name”,
“exc_type”: “AuthenticationError”,
“exc”: “[“Traceback (most recent call last):\n File \”/workspace/development/frappe-bench/apps/frappe/frappe/app.py\”, line 59, in application\n frappe.api.validate_auth()\n File \"/workspace/development/frappe-bench/apps/frappe/frappe/api.py\", line 157, in validate_auth\n validate_auth_via_api_keys(authorization_header)\n File \"/workspace/development/frappe-bench/apps/frappe/frappe/api.py\", line 209, in validate_auth_via_api_keys\n validate_api_key_secret(api_key, api_secret, authorization_source)\n File \"/workspace/development/frappe-bench/apps/frappe/frappe/api.py\", line 228, in validate_api_key_secret\n doc_secret = frappe.utils.password.get_decrypted_password(doctype, doc, fieldname=‘api_secret’)\n File \"/workspace/development/frappe-bench/apps/frappe/frappe/utils/password.py\", line 51, in get_decrypted_password\n frappe.throw(_(‘Password not found’), frappe.AuthenticationError)\n File \"/workspace/development/frappe-bench/apps/frappe/frappe/init.py\", line 432, in throw\n msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable, wide=wide, as_list=as_list)\n File \"/workspace/development/frappe-bench/apps/frappe/frappe/init.py\", line 411, in msgprint\n _raise_exception()\n File \"/workspace/development/frappe-bench/apps/frappe/frappe/init.py\", line 365, in _raise_exception\n raise raise_exception(msg)\nfrappe.exceptions.AuthenticationError: Password not found\n"]",
“_server_messages”: “[”{\“message\”: \“Password not found\”, \“indicator\”: \“red\”, \“raise_exception\”: 1}"]"
}

I never experienced this while working with Frappe version 12. I do not know how to go about this issue. Anyone who knows what this error means should please help.

Thanks.

1 Like

Please does anyone know how I can resolve this error? Kindly help

This error could also happen when you pass incorrect api_key & api_secret or site url.

I had multiple site urls in the postman and when I sent request to the wrong site, the same error popped up.

@ChillarAnand I have found this to be an ongoing issue with V13 starting with beta 10. The error has nothing to do with a different url but the way the API handles passwords. This error sometimes come up even when the supplied credentials are valid. When I login with the same credentials on ERPNext I don’t get the error. This issue also exists if you call the API logout function. Your login session does not end even though you receive the {} response. When you try to login again, you will receive login session expired response even though your login returns 200. To clear that error, you then have to logout and login again to completely clear the session timeout error which is a pain.

@Nwasiulo if you are still having the issue and using secret and key, try using the user login credentials instead to see if the issue is with the service credentials. If you still see the error, the workaround is to go to the user and change the use password, you can still use the same password. You will find that once you do this, your login will be successful. I think I posted this in another thread a few months back but no one seemed to notice or take an interest in the report.