Implementing JSON Web Token (JWT) in laravel 10
composer require php-open-source-saver/jwt-auth
by adding in guards array:
'driver' => 'jwt',
'provider' => 'users',
],
by implementing the PHPOpenSourceSaver\JWTAuth\Contracts\JWTSubject
interface in your user model
and overriding the getJWTIdentifier()
and getJWTCustomClaims()
methods.