I'm trying to customize the Magento API Engine 2. I would like to know if there is any time of the request, before arriving at webapi.xml to capture the token that came through the head and send it to a function that I created myself? If yes, how and where can I do this?

  • $this->userContext->getUserId(); from this vendor/magento/module-webapi/Controller/Rest/ParamOverriderCustomerId.php – Aditya Shah Jun 1 at 10:23
  • From above you can fetch Token – Aditya Shah Jun 1 at 10:23

I found a possibility:

use Magento\Framework\Webapi\Rest\Request;

$header = $this->request->getHeader('Authorization');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.