0

So was trying to build in a notification when a new API token was created it would notify me. I added in the events and listeners it said too in the documentation but it is giving me a 500 error now when i try to create a new token. When I comment out the listener the token creation bit works - its only when I add the listener back in that it 500 errors again. The token itself is being stored in the DB but the "name" of the token is blank in the DB. However on the front end it just errors out - and when i look in my console i am getting a 500 error:

POST domain.com/oauth/personal-access-tokens 500 (Internal Server Error)
dispatchXhrRequest @ app.js:11413
xhrAdapter @ app.js:11250
dispatchRequest @ app.js:11899

Event and listener:

'Laravel\Passport\Events\AccessTokenCreated' => [
    'App\Listeners\RevokeOldTokens',
],
Citti
  • 423
  • 1
  • 6
  • 23
  • What's the Laravel error output from `app/storage/logs/laravel.log`? – Eric Tucker Mar 03 '17 at 01:17
  • your `RevokeOldTokens` may be throwing a fatal error. Check the logs – Cerlin Mar 03 '17 at 04:54
  • local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Type error: Argument 1 passed to App\Listeners\RevokeOldTokens::handle() must be an instance of App\Events\Laravel\Passport\Events\AccessTokenCreated, instance of Laravel\Passport\Events\AccessTokenCreated given in /home/vagrant/Code/domain.dev/app/Listeners/RevokeOldTokens.php:27 – Citti Mar 03 '17 at 06:44

1 Answers1

0

awww Thank you guys! was looking at the screen for too long!

when it auto generated the listener it put in:

use App\Events\Laravel\Passport\Events\AccessTokenCreated;

instead of

use Laravel\Passport\Events\AccessTokenCreated;
Citti
  • 423
  • 1
  • 6
  • 23