Magento, Magento 2

How to get customer access token by REST API in Magento 2

In this tutorial, Today I will explain to how to get customer access token by REST API in Magento 2. In Magento 2, If you want to get customer access token you need to pass customer email id and customer password.

You may also like this :

By Default, customer token is valid for 1 hour. Still, if you want to update value of customer token expire time. Then, you can update value from below path and save config after update value :

Go to Admin -> Stores -> Configuration -> Services -> OAuth -> Access Token Expiration -> Customer Token Lifetime (hours)

1) First of all, Set End Point of REST API :

{{url}}rest/{store_code}/V1/integration/customer/token

{{url}} = Your_Site_Base_Url

2) After that, Set your End point as URL and set Method : POST

Set Params as like below way :

  • username(key) : rohan@gmail.com (value : customer email id)
  • password(key) : mage@123 (value : customer password)

 

Customer Access Token Magento 2

3) Then, Set Headers :

  • ContentType(Key): application/json(Value)

Now, Just Click on Send and you will receive response of customer token.

Response : io6kcz7ufugpcko9pfbb5uwp6a9b0odz

That’s it !!!

Now, you can use this customer token for REST API. For example, in customer address save, create etc.

I hope this blog is easy to understand about how to get customer access token by REST API in Magento 2. In case, I missed anything or need to add some information, always feel free to leave a comment in this blog, I’ll get back with proper solution.

Stay Safe and Stay Connected !!

Tagged , ,