1

I am trying to create a mobile app for a Magento 2.3 CE site, So far I have found where the Swagger documentation is and have managed to log in as a customer using the integrate endpoint.

What I don't understand is how I get the products and categories using the customer token, they all seem to require a admin token

1
  • You don't need the customer token to get the products. Your should be using graphql API
    – Haim
    Jul 6 '20 at 1:30
0

Follow this tutorial as they have explained it very nicely

https://www.mageplaza.com/devdocs/get-all-products-orders-categories-magento-2.html

Follow the below settings to fix the API issue.

Login to Admin >> Stores >> Stores >> Settings >> Configuration >> SERVICES >> Magento Web API >> Web API Security >> Allow Anonymous Guest Access: Yes

Please Note If this does not work for you then downgrading your php version will solve the issue

Hope it helps!

Thanks.

7
  • I tried to use this and got "message": "The consumer isn't authorized to access %resources.", Jul 6 '20 at 10:35
  • you might be using php 7.1??
    – Pramod
    Jul 6 '20 at 10:37
  • My server is running on php 7.3 Jul 6 '20 at 10:38
  • check updated ans
    – Pramod
    Jul 6 '20 at 10:40
  • Would this let unauthorised requests view the data to? because if possible i would like it to still be locked down to logged in customers Jul 6 '20 at 10:44
0

First, you need to take admin token using the admin username and password. Using that token, you can get product and category.

You can check this using either swagger or postman.

I hope it helps. Thank you.

1
  • In my question I did say I knew how to get the data using an admin token but this is for an android app to let customers make orders with the site so I cant use admin token. Jul 6 '20 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.