diadal / passport
Convert client_id to Uuid in Laravel Passport
Installs: 4 567
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=7.1
- laravel/passport: 6.*|7.*|8.*|9.*
- webpatser/laravel-uuid: ^3.0
This package is auto-updated.
Last update: 2024-11-23 10:32:57 UTC
README
Introduction
Laravel Passport is an OAuth2 server and API authentication package that is simple and enjoyable to use. This Package will enable you you convert client id and client_id to Uuid which is more secure and safe for production
Installation
composer require diadal/passport
Laravel 5.5 hight auto discover package you may need to register in your config app.php under providers
Diadal\Passport\PassportServiceProvider::class,
Next in app/Providers/AppServiceProvider.php
add \Laravel\Passport\Passport::ignoreMigrations();
to register
public function register() { //.... \Laravel\Passport\Passport::ignoreMigrations(); }
Next
php artisan config:clear
To publish Cilent Uuid migration use this
php artisan vendor:publish --tag=passport-cilent-migrations
if no file published try
php artisan config:clear
and retry php artisan vendor:publish --tag=passport-cilent-migrations
Note you can use this both
Migrate your Database
php artisan migrate
Next In AuthServiceProvider @ app/Providers/AuthServiceProvider.php
add use Diadal\Passport\Passport;
<?php namespace App\Providers; use Diadal\Passport\Passport; use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; class AuthServiceProvider extends ServiceProvider { /** * The policy mappings for the application. * * @var array */ protected $policies = [ 'App\Model' => 'App\Policies\ModelPolicy', ]; /** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); Passport::routes(); \Laravel\Passport\Passport::useClientModel(\Diadal\Passport\Client::class); \Laravel\Passport\Passport::usePersonalAccessClientModel(\Diadal\Passport\PersonalAccessClient::class); Passport::tokensCan([ 'all' => 'All Function', 'create-invoice' => 'Create Invoice', ]); Passport::tokensExpireIn(now()->addDays(15)); Passport::refreshTokensExpireIn(now()->addDays(30)); } }
Next, you should run the passport:install
command
php artisan passport:install
php artisan config:clear
All default Laravel Passport remain the same
Official Documentation
Documentation for Passport can be found on the Laravel website.
Any issue check here
also you can buy me a coffee @ Patreon