Author Topic: Login API is working fine but Account details API give 401 error  (Read 1927 times)

Offline praveenbaranwal

  • Newbie
  • *
  • Posts: 2
  • Karma: +1/-0
    • View Profile
I am trying to login using below API calls in postman client where i get the response as expected.
Req type: POST
URL: Target URL
Body has following parameter
email: praveenbaranwal
password: praveen123
api_key: sweedelight800
rt: a/account/login

I am able to get the login Success with response code 200.

Next i wanted to validate my login:
Req type: POST
URL: Target URL
Body has following paramater
token: use the value received in step 1
api_key: sweedelight800
rt: a/account/login

I am getting the response code as 200 and Authorized.

The same query was sent using a java class file created (Attached java class file) but i am getting error in the 2nd part where i am trying to validate if i am logged it.

I am not sure if token will be sent as header (if yes how?).

Regards,
Praveen
+91-9739048200




Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4265
  • Karma: +282/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Login API is working fine but Account details API give 401 error
« Reply #1 on: March 28, 2016, 10:12:48 PM »
I wonder if your Java class pass session/cookie in the request. How do you pass token back to the next request?
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1846
  • Karma: +277/-11
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: Login API is working fine but Account details API give 401 error
« Reply #2 on: March 29, 2016, 07:59:45 AM »
you can enable Debug mode in your Abantecart settings with output to log-file.
Also you can add your own logging inside api-controllers to recognise all environment variables
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline panthersam

  • Newbie
  • *
  • Posts: 12
  • Karma: +2/-0
    • View Profile
Re: Login API is working fine but Account details API give 401 error
« Reply #3 on: May 17, 2016, 07:50:13 AM »
Hello praveenbaranwal,

I need a help from you.How can i make big search bar like your site.Can you suggest me .

Offline praveenbaranwal

  • Newbie
  • *
  • Posts: 2
  • Karma: +1/-0
    • View Profile
Re: Login API is working fine but Account details API give 401 error
« Reply #4 on: May 17, 2016, 12:36:44 PM »
Hi Sam,

You can edit the Search field size by
1)goto file: public_html/storefront/view/default/stylesheet/style.css
2) Search for
.top-search input {
   width: 100%;
   border: 4px solid #F5F5F5;
   padding: 6px;
   float: left;
   vertical-align: middle;
}
Now edit the width % based on your choice. You can also choose where to keep the search box (Left or right)

Hope this helps.

Regards,
Praveen

Offline Rawinder Dhillon

  • Newbie
  • *
  • Posts: 13
  • Karma: +3/-0
    • View Profile
Re: Login API is working fine but Account details API give 401 error
« Reply #5 on: August 04, 2020, 02:54:01 PM »
parveen , did you solved the problem ???

Offline Rawinder Dhillon

  • Newbie
  • *
  • Posts: 13
  • Karma: +3/-0
    • View Profile
Re: Login API is working fine but Account details API give 401 error
« Reply #6 on: August 21, 2020, 04:09:51 PM »
dont know it is helpful or not for parveen now but may be helpful for someone else :-)
i solved this one
in 2nd step use
rt: a/account/account instead of rt: a/account/login
and we need to send cookies in headers that mainly include session and customer cookies that we received in step 1.



 

Powered by SMFPacks Social Login Mod