Hello everyone... I'm having the following problem.. I use web guard with "Collaborator" model, but in api guard, I want to use "Responsible" model for authentication (basic)...
When I set an username/password of "Collaborator" in Authentication header, the request return success. But when I set an username/password of "Responsible" model it returns "Invalid credentials".
Can anyone help-me with this problem? Here's some pieces of code:
public function register()
{
$this->app['Dingo\Api\Transformer\Factory']->setAdapter(function ($app) {
$fractal = new Manager();
$fractal->setSerializer(new JsonApiSerializer());
return new Fractal($fractal);
});
app('Dingo\Api\Auth\Auth')->extend('basic', function ($app) {
return new Basic($app['auth'], 'cpf');
});
}
routes/api.php
$api->version('v1', function ($api) {
$api->group(['namespace' => 'App\Api\V1\Controllers'], function ($api) { // Use this route group for v1
$api->post('/login', 'AuthController@login')->name('users.login');
$api->get('/teste', 'AuthController@teste')->name('users.test')->middleware('api.auth');
});
});
Actual Behaviour
Hello everyone... I'm having the following problem.. I use web guard with "Collaborator" model, but in api guard, I want to use "Responsible" model for authentication (basic)...
When I set an username/password of "Collaborator" in Authentication header, the request return success. But when I set an username/password of "Responsible" model it returns "Invalid credentials".
Can anyone help-me with this problem? Here's some pieces of code:
config/auth.php
App/Providers/ApiServiceProvider.php
routes/api.php