soumen-dey / api-authenticator
A Laravel auth package for API authentication.
Requires
This package is not auto-updated.
Last update: 2025-02-21 04:34:46 UTC
README
A Laravel package for API Authentication based on Laravel Passport.
Note: This package requires Laravel Passport to be installed.
Installation
Via Composer
$ composer require soumen-dey/api-authenticator
Usage
Functionality
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.
Adding the routes:
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.
Change log
Please see the changelog for more information on what has changed recently.
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
License
license. Please see the license file for more information.