I have a Phalcon PHP application where I’m trying to implement token-based authentication. I have a method in my code like this:
public function infoAction()
{
$access_token = $this->request->getHeader('Authorization');
if (!$this->isLoggedIn($access_token)) {
return $this->unauthorized();
}
return $this->response->setJsonContent($this->getUserInfo());
}
When I register, I receive a token like this:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyNTZ9.v0cXrqoDEix-xCSVa8aFzNvyLW1monPv0lsaB8cj0Rc
Now, I want to test the infoAction method in Postman. I’m adding the token I received during registration to the “Authorization” header in Postman with the key “Authorization,” and I set the value to the token. However, after sending the request, it seems like the token parameters are not being read, and I’m not getting the expected result.
I’m looking for guidance on how to properly send and read the token in the “Authorization” header using Postman with my Phalcon PHP application.
I even tried to put that token as Bearer token in the Authorization section, but the problem was still not solved