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',
],
答案 0 :(得分:0)
当它自动生成它放入的监听器时:
use App\Events\Laravel\Passport\Events\AccessTokenCreated;
而不是
use Laravel\Passport\Events\AccessTokenCreated;