How to Revoke customer access token Magento 2?

Magento 2 Revoke customer access token for the current customer by customer id.

If the customer has already access token, that will be stored inside the oauth_token table in the database. A token column used to save the value of specific customer token.

When you call the revoke token method, all the available token for the customer will be removed from the database table.

<?php
namespace Jesadiya\RevokeCustomerToken\Model;

use Magento\Integration\Model\Oauth\TokenFactory as TokenModelFactory;

class RevokeCustomerToken
{
    /**
     * @var CustomerTokenService
     */
    private $customerToken;

    public function __construct(
        CustomerTokenService $customerToken
    ) {
        $this->customerToken = $customerToken;
    }

    /**
     * Revoke Customer token
     *
     * @param int $customerId
     * @return bool
     */
     public function revokeCustomerToken(int $customerId)
    {
        return $this->customerToken->revokeCustomerAccessToken($customerId);
    }
}

Call method by customer id,

$customerId = 1;
$result = $this->revokeCustomerToken($customerId);

Output:
bool