2

Customer is signup through rest api in magento 2.3 successfully. after signup, I am unable to get customer's token through customer/token rest api.

Api returns following error:

enter image description here

Any help, experience and knowledge sharing would be appreciated.

  • Hello @Muhammad, magefms is right 'all' shouldn't be there in URL and in devdocs devdocs.magento.com/guides/v2.3/get-started/authentication/… there is also the url without "all" key word – Aditya Shah Apr 16 '19 at 7:30
  • 6
    @Aaditya POST <host>/rest/<store_code>/V1/integration/customer/token. You can also this in devdocs in endpoint detail. Thanks for the comment – Muhammad Hasham Apr 16 '19 at 7:32
  • 1
    Yes totally agree /rest/english/V1/integration/customer/token I have Eglish store name which is working fine, Do you have store named "all" ? – Aditya Shah Apr 16 '19 at 7:34
  • 2
    and If you haven't configure then you can go with /rest/default/V1/integration/customer/token – Aditya Shah Apr 16 '19 at 7:35
  • 2
    @Aaditya that's the thing I am looking for. Nice point Yes It is for default. Now you got it – Muhammad Hasham Apr 16 '19 at 7:53
2

For customer token if you want it store wise then you need to pass store_code in the API url

POST <host>/rest/<store_code>/V1/integration/customer/token

But if you haven't configure any stores then pass default

POST <host>/rest/default/V1/integration/customer/token

And to fetch all store data using API

storeStoreRepositoryV1


Group repository interface

http://magento.host/index.php/rest/V1/store/storeGroups
  • method : GET
  • Authorization : Bearer <admin token>

This will return website_id, root_category_id, default_store_id, name, code


1

Instead of using /rest/all/V1/integration/customer/token
use this endpoint /rest/V1/integration/customer/token and you will get token.

  • It should be /rest/all/V1. check the endpoint detail in documentation. A combination of the server that fulfills the request, the web service, and the resource against which the request is being made. For example, in the POST <host>/rest/<store_code>/V1/integration/customer/token endpoint: The server is magento.host/index.php/, the web service is rest. and the resource is /V1/integration/customer/token. – Muhammad Hasham Apr 16 '19 at 7:08
  • okay just want to share what works as per my experience – fmsthird Apr 16 '19 at 7:14

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.