Generate customer access token in Magento using a specific 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:
<HOST_URL>/rest/{store_code}/V1/integration/customer/token
Where store_code is your store code. Native store_code is the default.
Action:
POST
Payload Request Body:
{
"username":"username@fake.com", "password":"your_password"
}
Response:
You need to use a response string for the authorization header of every call where the customer access token is needed.
For example, To create a new address, you need to use an access token In the header of the request call,
Authorization Bearer <CUSTOMER_ACCESS_TOKEN>