Use Laravel Airlock (at least that is what it's called at the moment) for that.
Mar 19, 2020
4
Level 9
Take login web routes and convert to api
My routes are in web.php but I need to install passport and use api but I don't know how to take the default laravel login logic and turn it in to api and use the api tokens for logging in, I read the docs and have done the basic setup and also added a column api_token to my users table.
This is what I have in my web.php
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login')->name('login.attempt')->uses('Auth\LoginController@login');
Route::group(['middleware' => 'auth'], function () {
Route::resource('/', 'DashController');
Route::get('/logout')->name('logout')->uses('Auth\LoginController@logout');
Route::resource('users', 'UserController');
});
If I need to later on create an app for this project should I just move everything to the api or what should I do in order to get this already started project working with passport and a future app?
Please or to participate in this conversation.