As capture the token that came through the head and send it to a function that I created myself?

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?

Solutions

I found a possibility:

use Magento\Framework\Webapi\Rest\Request;

$header = $this->request->getHeader('Authorization');
Tags: Magento 2.x / API / Rest

Similar questions

Error after Deleting Unused Categories that came with theme
I was deleting the categories that came with a theme I purchased for Magento 2, and adding in my own, but now when I visit the site I get this error:
In magento 2 admin custom field value stored in db but when edit a product edit page custom field came empty, how to solve this
app/code/Cm/Preoder/view/adminhtml/ui_component/product_form.xml app/code/Cm/Preorder/etc/adminhtml/events.xml app/code/Cm/Preoder/Observer/ProductSaveAfter.php In product edit form, custom field shows empty after value saved in db Saved value
Magento redirect to the page from that came
I have a module which had instaled a CMS page with some default URL and some text with form. On this form I have fields and submit. I validate my fields using ajax(send POST in controller of my module). If validation is OK, I redirect to the same page with "succes message". The problem is, that the default URL of this CMS page in which I make redir...
Magento 2: unable to set payment Transaction Id after successful payment processing (solved by myself)
I am unable to set payment transaction id after successful payment processing... I have got payment confirmation transaction details by payment gateway on my controller action. Now I need to save the payment transaction id in \Magento\Payment\Model\InfoInterface $payment by using setTransactionId method of above interface. But unable to use the \Ma...
UiComponent export button issue, error: getRowData() must be an instance of Magento\Framework\Api\Search\DocumentInterface (Solved by myself)
I am using Ui-Component for export button for export grid column with below code: Anyone have faced this kind of issue... Please let me know if i need to post my Dataprovider class My collection file is below: Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Ui\Model\Export\MetadataProvider::getRowData() must be an instance of Magento\...
M2 | Self Collection | I will pick it up myself option in checkout page
I want to show pickup from shop option in shipping method. The customer can choose either delivery to my address or ill pick up from the shop. any idea anyone about this?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.