dusterio / lumen-passport

Making Laravel Passport work with Lumen
MIT License
655 stars 139 forks source link

Access is still there even after Token expired #133

Closed santanubiswascispl closed 4 years ago

santanubiswascispl commented 4 years ago

Using this Package for Lumen Passport authentication, everything is working fine except one thing, which is the token expiry datetime, this package doesn't care about the token expiry time.

There is an issue regarding this here https://github.com/dusterio/lumen-passport/issues/12 but this issue was closed without any solution, a full of discussion here, please provide a solution to it

santanubiswascispl commented 4 years ago

After going through the Passport documentation I finally found the solution.

Step 1: Uncomment $app->register(App\Providers\AuthServiceProvider::class); from bootstrap/app.php file

Step 2: In the boot function of AuthServiceProvider.php add the below 2 lines

Passport::tokensExpireIn(Carbon::now()->addDays(7)); // expire in 7 days Passport::refreshTokensExpireIn(Carbon::now()->addDays(10)); // expire in 10 days