Downloads
Stars
Version
A Laravel package for API Authentication based on Laravel Passport.
Via Composer
$ composer require soumen-dey/api-authenticator
This package uses the default implementation for Auth that Laravel ships out of the box for validation and various other purposes.
So the validation, user table structure (except for the tokens part) should be similar for both web and api.
Note: This package uses the default User
model in the App\User
namespace. Feel free to modify the source code if you want to change this.
In your routes/api.php
file, add the following:
Authenticator::routes();
This will add the required routes which are:
POST api/register
POST api/login
Note: Make sure that your request has these headers:
Content-Type: application/json
X-Requested-With: XMLHttpRequest
These are the API endpoints for authenticating users. The payload for these endpoints should be same as for the web auth, any extra payload depends on the application's logic.
Please see the changelog for more information on what has changed recently.
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email author email instead of using the issue tracker.
license. Please see the license file for more information.