Skip to content

Commit

Permalink
install and setup passport
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedHelalAhmed committed Dec 18, 2021
1 parent 5094121 commit d2a02aa
Show file tree
Hide file tree
Showing 6 changed files with 1,040 additions and 23 deletions.
1 change: 1 addition & 0 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Kernel extends HttpKernel
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
],

'api' => [
Expand Down
6 changes: 4 additions & 2 deletions app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Providers;

use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
use Laravel\Passport\Passport;

class AuthServiceProvider extends ServiceProvider
{
Expand All @@ -25,6 +25,8 @@ public function boot()
{
$this->registerPolicies();

//
if (!$this->app->routesAreCached()) {
Passport::routes();
}
}
}
11 changes: 7 additions & 4 deletions app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@

namespace App;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;

class User extends Authenticatable
{
use Notifiable;
use Notifiable, HasApiTokens;

/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
'name',
'email',
'password',
];

/**
Expand All @@ -25,7 +27,8 @@ class User extends Authenticatable
* @var array
*/
protected $hidden = [
'password', 'remember_token',
'password',
'remember_token',
];

/**
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"php": "^7.2.5|^8.0",
"fideloper/proxy": "^4.4",
"laravel/framework": "^6.20.26",
"laravel/passport": "*",
"laravel/tinker": "^2.5"
},
"require-dev": {
Expand Down
Loading

0 comments on commit d2a02aa

Please sign in to comment.