Skip to content

Token immediately blacklisted #983

@njt1982

Description

@njt1982

I'm upgrading my Laravel 5.2 app to Lumen 5.4 and have managed to repair my app to a point where I can at least log in again ;)

So on login, I get a token back and my Angular app stores it and makes 3 API requests with it. These all work perfectly.

Then I click something to make another request. This request fails with:

The token has been blacklisted

I can confirm the correct header is being sent:

Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9............

I get 2 stack traces... 1/2 is this:

TokenBlacklistedException in Manager.php line 97:
The token has been blacklisted

in Manager.php line 97
at Manager->decode(object(Token)) in JWT.php line 183
at JWT->getPayload() in JWTAuth.php line 60
at JWTAuth->authenticate() in BaseMiddleware.php line 69
at BaseMiddleware->authenticate(object(Request)) in Authenticate.php line 30
at Authenticate->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in RoutesRequests.php line 779
at Application->sendThroughPipeline(array('Tymon\\JWTAuth\\Http\\Middleware\\Authenticate', 'Tymon\\JWTAuth\\Http\\Middleware\\RefreshToken'), object(Closure)) in RoutesRequests.php line 625
at Application->handleFoundRoute(array(true, array('uses' => 'App\\Http\\Controllers\\AuctionController@index', 'middleware' => array('jwt.auth', 'jwt.refresh')), array())) in RoutesRequests.php line 528
at Application->Laravel\Lumen\Concerns\{closure}() in RoutesRequests.php line 782
at Application->sendThroughPipeline(array(), object(Closure)) in RoutesRequests.php line 534
at Application->dispatch(null) in RoutesRequests.php line 475
at Application->run() in index.php line 35

Then 2/2 is this:

UnauthorizedHttpException in BaseMiddleware.php line 71:
The token has been blacklisted
in BaseMiddleware.php line 71
at BaseMiddleware->authenticate(object(Request)) in Authenticate.php line 30
at Authenticate->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in RoutesRequests.php line 779
at Application->sendThroughPipeline(array('Tymon\\JWTAuth\\Http\\Middleware\\Authenticate', 'Tymon\\JWTAuth\\Http\\Middleware\\RefreshToken'), object(Closure)) in RoutesRequests.php line 625
at Application->handleFoundRoute(array(true, array('uses' => 'App\\Http\\Controllers\\AuctionController@index', 'middleware' => array('jwt.auth', 'jwt.refresh')), array())) in RoutesRequests.php line 528
at Application->Laravel\Lumen\Concerns\{closure}() in RoutesRequests.php line 782
at Application->sendThroughPipeline(array(), object(Closure)) in RoutesRequests.php line 534
at Application->dispatch(null) in RoutesRequests.php line 475
at Application->run() in index.php line 35

As you can see in there, I am using jwt.auth and jwt.refresh middleware...

$app->group(['prefix' => 'api/v1'], function() use ($app) {
  $app->post('login', 'AuthController@login');

  $app->group(['middleware' => ['jwt.auth', 'jwt.refresh']], function() use ($app) {
  ...
  ...

Any tips?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions