I’m using the CakeDC/Users plugin in my CakePHP 4 application for user authentication via form login. Now, I’m working on an API that uses token-based authentication, and so far, everything is working well.
However, I’m struggling with creating an API endpoint that allows users to obtain a token by sending their username and password via a POST request. Ideally, I’d like to implement a function that verifies the credentials and returns a valid authentication token.
Has anyone done something similar with CakeDC/Users? What would be the best approach to achieve this?
There are multiple ways how you can achieve that, but the most straight forward way would be to just manually create a controller action, create the hashed password and check, if a user is present with the given username and password.
Tnx @KevinPfeifer for a really helpful response. This is what I was thinking of last resort so I asked here for a better solution. But for now this will be the solution. Tnx again.