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

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:

eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjY1LCJ1dHlwaWQiOjMsImlhdCI6MTY3NzA2MzczOSwiZXhwIjoxNjc3MDY3MzM5fQ.rY3Q-fdajoNMMXp1UpaGlRWnlhNBEtv4foJFn4Txmpo

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>