This package helps you quickly scaffold api authentication for you laravel project using
NB: always install this package on a fresh install of laravel since it will overwrite some existing files
You can install the package via composer:
composer require lacasera/api-jwt-scaffold --dev
- run the command
php artisan make:auth-api
An Auth and Register Controllers will be generated under the Auth namespace to handle authentication requests to your application.
Feel free to modify them to your applications needs.
- define your routes
//api.php
Route::group(['namespace' => 'Auth'], function(){
Route::get('me', 'AuthController@me');
Route::post('login', 'AuthController@login');
Route::get('logout', 'AuthController@logout');
Route::post('register', 'RegisterController@create');
});
-
Make sure your requests to the api routes add the
Accepts: application/json
header. -
Enjoy.
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email aboateng62@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.