I’m having trouble with authenticating via custom endpoints.
How do I accept POST requests in stead of GET?
I cannot accept passwords containing a “+” (plus sign).
these are translated to a " " (space) and then clearly not work.
When sending the request with POST the params are empty.
And how do I accept email in stead of username
I use this script provided by @artur
/config/user/auth.php
<?php
$user = $this->param('user');
$password = $this->param('password');
if (!$user || !$password) {
return $this->stop(['error' => 'User and password are required'], 412);
}
$user = $this->helper('auth')->authenticate(compact('user', 'password'));
if (!$user) {
return $this->stop(['error' => 'Authentication failed!'], 412);
}
return ['apiKey' => $user['apiKey']];