Hello,
I'm trying to create an api in laravel 5.2
What I'm trying to do is the following:
1 - Continue using the default auth system for web user.
2 - create an api for users of an application.
I am using the method: auth: api, but with this method I am required to know the token of the user and what I wanted was the following in the api user type the user and password gives with this I would return the token and he could access their pages or registers etc ...
My route.php
Route::get('/', function () {
return redirect('/home');
});
Route::auth();
Route::get('/home', 'HomeController@index');
Route::group(['prefix' => 'api/v1', 'middleware' => 'auth:api'], function () {
Route::get('/', function () {
return Auth::guard('api')->user();
});
});
Thank you