Setting headers at the controller view

Hello everyone, I’m new to CakePHP but I have been using it for almost a year now. I’m doing some tryouts with a REST API that uses JWT and I’m trying to use the same code for logging into the website. Right now I’m storing the token in a header cookie (set-cookie) and I was wondering if there is a way to set the “Authorization Bearer” from a view without using the httpclient (curl like facility). Or even better set the Authorization header at the controller?

https://book.cakephp.org/3.0/en/controllers/request-response.html#setting-headers