3

I am working on a default Magento setup and facing the default rest API not responding on checkout and throwing 401 error.

{"message":"Consumer is not authorized to access %resources"...}

For example below APIs not working for logged in users.

/rest/default/V1/carts/mine/estimate-shipping-methods
/rest/default/V1/carts/309215/estimate-shipping-methods-by-address-id
/rest/V1/wishlist

is there any missing configuration?

is there any session/cookies related issue?

is they are customer specific?

Please share your thoughts on the same.

asked Jan 17, 2019 at 14:21

1 Answer 1

0

To access default APi with /mine/ you need to pass a bearer token that you generate for a customer using

/rest/V1/integration/customer/token

with body

{
 "username": "[email protected]",
 "password": "admin@123"
}

you will get token in response , pass that in header or in authorization tab in you postman like enter image description here

and for some requests you may require admin level access (you can check in ACL of that API request) , you can create admin token using

/rest/default/V1/integration/admin/token

with body

{
 "username": "admin",
 "password": "admin123"
}

also you can refer to the documentation

answered Jan 28, 2019 at 5:39
2
  • 2
    I am not creating any API, just facing these issues on default checkout process. Commented Jan 28, 2019 at 5:46
  • i am referring to existing API only Commented Jan 28, 2019 at 5:48

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.