How to generate customer access token by REST API Magento 2?

Generate customer access token in Magento using specify username and password of the customer in the payload request.

By default, a customer token is valid for 1 hour only. To change the default value of the system,
Go to admin panel,
Click Left sidebar Stores > Settings > Configuration > Services > OAuth > Access Token Expiration.

Enter a new value for Customer Token Lifetime(hours) in the text box.
Save Config.

EndPoint URL:


Where store_code is your store code. Native store_code is the default.



Content-Type: application/json

Payload Request Body:

    "username":"", "password":"your_password"


On Success of Payload data, Magento returns the customer’s access token with 32 character random string.

You need to use a response string for the authorization header of every call where the customer access token is needed.

Example, To create a new address, you need to use access token In the header of request call,

Authorization Bearer <CUSTOMER_ACCESS_TOKEN>

Authorization Bearer yo1cusx5lo69kdmulbzcquruiuv67lko