Login api issue

I need to rest api for authentication(Login). So I was used your Auth api which has provided in your documentation but, I had issue in response. The response code is always 200 when username or password is correct or incorrect and getting response in html format.

I am also getting the same issue can any one please suggest some way to call and check axelor API correctly as login api is indeed the most important api which we have not even changed just utilizing as given on axelor pl

That’s because you probably forgot to specified Content-Type and X-Requested-With in headers.
Add X-Requested-With: XMLHttpRequest and Content-Type: application/json in Postman headers tab, and send the request. You will receive a 401 Unauthorized status in case of wrong login credentials or 200 Ok status in case of sucessfull login.

X-Requested-With is mainly used to identify Ajax requests. Most JavaScript frameworks send this header with value of XMLHttpRequest.

Without him, you receive a 200 Ok status even if the credentials are wrong because there is a redirection to login form in case of failure when regular HTML form is used.

2 « J'aime »

thanks this worked perfectly but now I need my login user data how to get it?

Your credentials depends on your installation and the user you want use for the API.
If you deploy the app from scratch, use the default login/password. This is admin/admin !

I have installed version 6.0.3. When I am accessing localhost: 8080 / login.jsp, regardless of right / wrong password, always login page is getting retured.

I have used following option
Basic Auth: admin / admin

header: X-Requested-With = XMLHttpRequest
Content-Type = application / json

Body: {
« username »: « admin »,
« password »: « admin »

Also it provides cookie:
JSESSIONID = D1C36B38DC0862C05F49CF91E1142B00; Path = /; Domain = localhost; HttpOnly;

But when I am trying to access any other WS with same cookie, then I receive HTTP Status 401 - Unauthorized

http: // localhost: 8080 / ws / meta / models

I also tried with Basic Auth: admin / admin

I also do not see property: auth.local.basic.auth.enabled in « axelor-source\axelor-erp\modules\axelor-open-suite »

Please help!