Using API to login: only usr/pwd works, token and Basic won't work


I’m on v13.51.1.

It is very strange. Using Postman, I try to log in via API.

It works using usr and pwd combination.

It doesn’t work when I use token & Bearer.

Following Token Based Authentication numerous times.

URL to call via API: http://server/api/method/login
Header: “Authorization” in key, either “token c3334ac1610da68:05f4a1a1ed8e5f4” or “Basic api-key:api-secret

Frappe seems to insist on using “usr” and “pwd”:

	"message": "Incomplete login details",
	"exception": "frappe.exceptions.AuthenticationError",
	"exc": "[\"Traceback (most recent call last):\\n  File \\\"apps/frappe/frappe/\\\", line 55, in application\\n    init_request(request)\\n  File \\\"apps/frappe/frappe/\\\", line 127, in init_request\\n    frappe.local.http_request = frappe.auth.HTTPRequest()\\n  File \\\"apps/frappe/frappe/\\\", line 36, in __init__\\n    self.set_session()\\n  File \\\"apps/frappe/frappe/\\\", line 70, in set_session\\n    frappe.local.login_manager = LoginManager()\\n  File \\\"apps/frappe/frappe/\\\", line 117, in __init__\\n    if self.login() == False:\\n  File \\\"apps/frappe/frappe/\\\", line 140, in login\\n    self.authenticate(user=user, pwd=pwd)\\n  File \\\"apps/frappe/frappe/\\\", line 241, in authenticate\\n\\\"Incomplete login details\\\"), user=user)\\n  File \\\"apps/frappe/frappe/\\\", line 302, in fail\\n    raise frappe.AuthenticationError\\nfrappe.exceptions.AuthenticationError\\n\"]"

What’s up?

here you should use this method : /api/method/frappe.auth.get_logged_user not the login one

Dear @Asmaa_Al-hosain , how did you managed to get that to work with “token authentication”? I have been trying for many many days/hours and I can’t seem to get the token based authentication method to work. It always shows that I’m logged in as Guest, no matter whether I’m using base64 encoded basic authentication of token based authentication. I’m at my wits end and hoping that someone is able to assist in this.