Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Laravel, Is there a way to delete old revoked/expired passport tokens

I'm Using Laravel passport for API implementation, When user logged into the site it creates a new token, the old ones are revoked, due to this records are getting increased day by day..

Is there anyway to delete passport expired tokens ?

Thanks in advance.

like image 945
Anil kumar Avatar asked Nov 29 '22 21:11

Anil kumar


1 Answers

Laravel style

We'll be using this command to purge revoked and expired tokens:

<?php

namespace App\Console;

class Kernel extends ConsoleKernel
{
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('passport:purge')->dailyAt('03:00');
    }
}
like image 144
Vitalij Avatar answered Dec 26 '22 11:12

Vitalij