# Slim 4 JWT error

**URL:** <https://discourse.slimframework.com/t/slim-4-jwt-error/3320>\
**Category:** Questions\
**Created:** [August 7, 2019, 8:32am UTC](https://discourse.slimframework.com/t/slim-4-jwt-error/3320 "2019-08-07T08:32:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibrahimbalci](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/ibrahimbalci/32/923_2.png) [@ibrahimbalci](https://discourse.slimframework.com/u/ibrahimbalci)\
**Post date:** [August 7, 2019, 8:32am UTC](https://discourse.slimframework.com/t/slim-4-jwt-error/3320/1 "2019-08-07T08:32:20Z")

</div>

Hı, I trie slim 4 and tuupola/slim-jwt-auth. Everything is good but if token is wrong error function is not return json.I get the following error  
**Fatal error** : Uncaught RuntimeException: No PSR-7 implementation available in

```
$app->add(new Tuupola\Middleware\JwtAuthentication([
"secret" => "supersecretkeyyoushouldnotcommittogithub",
"error" => function ($response, $arguments) {
    $data["status"] = "error";
    $data["message"] ='error';
    return $response
        ->withHeader("Content-Type", "application/json")
        ->getBody()->write(json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
}

```

]));

---

<div class="post-metadata">

**Author:** ![l0gicgate](https://avatars.discourse-cdn.com/v4/letter/l/41988e/32.png) [@l0gicgate](https://discourse.slimframework.com/u/l0gicgate)\
**Post date:** [August 7, 2019, 5:23pm UTC](https://discourse.slimframework.com/t/slim-4-jwt-error/3320/2 "2019-08-07T17:23:21Z")

</div>

Did you install a PSR-7 implementation?

- [Slim-Psr7](https://github.com/slimphp/Slim-Psr7) - Install using `composer require slim/psr7`
- [Nyholm/psr7](https://github.com/Nyholm/psr7) & [Nyholm/psr7-server](https://github.com/Nyholm/psr7-server) - Install using `composer require nyholm/psr7 nyholm/psr7-server`
- [Guzzle/psr7](https://github.com/guzzle/psr7) & [http-interop/http-factory-guzzle](https://github.com/http-interop/http-factory-guzzle) - Install using `composer require guzzlehttp/psr7 http-interop/http-factory-guzzle`
- [zend-diactoros](https://github.com/zendframework/zend-diactoros) - Install using `composer require zendframework/zend-diactoros`

---

<div class="post-metadata">

**Author:** ![ibrahimbalci](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/ibrahimbalci/32/923_2.png) [@ibrahimbalci](https://discourse.slimframework.com/u/ibrahimbalci)\
**Post date:** [August 9, 2019, 9:07pm UTC](https://discourse.slimframework.com/t/slim-4-jwt-error/3320/3 "2019-08-09T21:07:20Z")

</div>

Yes I did.I’m use slim/psr7 ^0.4.0

---

<div class="post-metadata">

**Author:** ![jDolba](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/jdolba/32/815_2.png) [@jDolba](https://discourse.slimframework.com/u/jDolba)\
**Post date:** [August 13, 2019, 9:45pm UTC](https://discourse.slimframework.com/t/slim-4-jwt-error/3320/4 "2019-08-13T21:45:32Z")

</div>

isn’t this same error as you ask on stackoverflow?

```auto
"error" => function ($response, $arguments) {

```

should be

```auto
"error" => function ($request, $response, $arguments) {

```

also the error message you got is not really clear, can you add more precise details?

---

<div class="post-metadata">

**Author:** ![ibrahimbalci](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/ibrahimbalci/32/923_2.png) [@ibrahimbalci](https://discourse.slimframework.com/u/ibrahimbalci)\
**Post date:** [August 13, 2019, 10:14pm UTC](https://discourse.slimframework.com/t/slim-4-jwt-error/3320/5 "2019-08-13T22:14:50Z")

</div>

It’s fixed when I’m update slim 4.0.0 to 4.1.0
