I have been trying to implement the JWT-Aut in Laravel's Dingo API package, but I am stuck at users Login part, I have checked the official docs for auth but cant figure out, here is what I have done till now.
Protected the routes
Route::api(['version' => 'v1', 'protected' => true], function () {
Route::resource('users', 'UserController');
});
Added JWT auth provider in dingo/config
'jwt' => function ($app) {
return new Dingo\Api\Auth\JWTProvider($app['tymon.jwt.auth']);
}
Installed the JWT-Auth from Github docs
Tried Login using below sample code from JWT-Auth docs using Postman but getting {token : false}
Route::post('auth/login', function () {
$credentials = Input::only('email', 'password');
if ( ! $token = JWTAuth::attempt($credentials) )
{
// return 401 error response
}
return Response::json(compact('token'));
});
If someone can guide how I can login logout, & signup user and make a request with Authorization: Bearer <token> will be very helpful.
If someone could share your auth controller for same will be lifesaver :)