Simple Auth for Laravel
We're using Laravel Passport or Laravel Sanctum for api authetication.
Requirement:
- Laravel 9 and above
- Choose either
Laravel Passport or Laravel Sanctum
Setup
- First, run
php artisan migrate to setup migration in database
- If you're using Laravel Passport, please run
php artisan passport:install to install oauth client key
- Extend use
Zdirnecamlcs96\Auth\Models\User as Base
- Import either one of the Trait in
app/Models/User.php file
use Laravel\Passport\HasApiTokens;
use Laravel\Sanctum\HasApiTokens;
- You may publish the
config/authetication.php and modify the mode.
- All done. You may test your auth with Postman.
Available Contracts
Available Tratis
| Trait |
Description |
Zdirnecamlcs96\Auth\Traits\HasSocialIdentity |
Add SocialIdentity relationship with third party token |
Zdirnecamlcs96\Auth\Traits\HasContact |
Add Contact relationship with verification status |