lacasera/api-jwt-scaffold

scaffold jwt authentication for your api

dev-master 2019-10-06 23:01 UTC

This package is auto-updated.

Last update: 2024-04-07 09:21:27 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

This package helps you quickly scaffold api authentication for you laravel project using

  1. Laravel Passport
  2. Tymon JWT

Installation

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

Usage

  1. 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.
  1. 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');
});
  1. Make sure your requests to the api routes add the Accepts: application/json header.

  2. Enjoy.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email aboateng62@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.