By using whitelist api why i can login as administrator only but not with other user

by this code i can login with administrator and administrator credential by passing it in the parameter but i tried with other users its returns Invalid Credentials…how can i solve this.?

def login(usr, pwd):
    login_manager = frappe.auth.LoginManager()
    login_manager.authenticate(user=usr, pwd=pwd)

    "message": "Invalid login credentials",
    "exception": "frappe.exceptions.AuthenticationError",
    "exc": "[\"Traceback (most recent call last):\\n  File \\\"apps/frappe/frappe/\\\", line 69, in application\\n    response = frappe.api.handle()\\n  File \\\"apps/frappe/frappe/\\\", line 54, in handle\\n    return frappe.handler.handle()\\n  File \\\"apps/frappe/frappe/\\\", line 45, in handle\\n    data = execute_cmd(cmd)\\n  File \\\"apps/frappe/frappe/\\\", line 83, in execute_cmd\\n    return, **frappe.form_dict)\\n  File \\\"apps/frappe/frappe/\\\", line 1599, in call\\n    return fn(*args, **newargs)\\n  File \\\"apps/library_management/library_management/\\\", line 75, in login\\n    login_manager.authenticate(user=usr, pwd=pwd)\\n  File \\\"apps/frappe/frappe/\\\", line 254, in authenticate\\n\\\"Invalid login credentials\\\")\\n  File \\\"apps/frappe/frappe/\\\", line 307, in fail\\n    raise frappe.AuthenticationError\\nfrappe.exceptions.AuthenticationError\\n\"]"

@BalaV there is already login api in erpnext and it works just fine with all users .

1 Like

It returns session erpired for me.!

@BalaV try to logout and then lohin . and I suggest to use postman

1 Like

i will try it and thank you for your help :+1: