# Validate JWT user token on each request

**URL:** <https://discourse.cakephp.org/t/validate-jwt-user-token-on-each-request/5501>\
**Category:** Need Help\
**Created:** [January 8, 2019, 11:26am UTC](https://discourse.cakephp.org/t/validate-jwt-user-token-on-each-request/5501 "2019-01-08T11:26:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![okelet](https://avatars.discourse-cdn.com/v4/letter/o/919ad9/32.png) [@okelet](https://discourse.cakephp.org/u/okelet)\
**Post date:** [January 8, 2019, 11:26am UTC](https://discourse.cakephp.org/t/validate-jwt-user-token-on-each-request/5501/1 "2019-01-08T11:26:34Z")

</div>

Hi, I am using the @ADmad JWT Auth plugin. Mi problem now is that If I disable a user while JWT authenticated, the token continues usable. Is there anyway to check for every JWT request if the user exists, is enabled, etc., and if user access forbidden, deny the request?

Thanks!

---

<div class="post-metadata">

**Author:** ![Diego](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/diego/32/296_2.png) [@Diego](https://discourse.cakephp.org/u/Diego)\
**Post date:** [January 8, 2019, 11:37am UTC](https://discourse.cakephp.org/t/validate-jwt-user-token-on-each-request/5501/2 "2019-01-08T11:37:34Z")

</div>

set the custom finder in auth config:

```
$this->loadComponent('Auth', [
            'storage' => 'Memory',
            'authenticate' => [
                'ADmad/JwtAuth.Jwt' => [
                    'userModel' => 'Users',
                    'finder' => 'auth', // <<<<HERE
                    'fields' => ['username' => 'id'],
                    'parameter' => 'token',
                    // Boolean indicating whether the "sub" claim of JWT payload
                    // should be used to query the Users model and get user info.
                    // If set to `false` JWT's payload is directly returned.
                    'queryDatasource' => true,
                ],
            ],

```

and in UsersTable.php

```
public function findAuth(Query $query, array $options)
    {
        $query->where(['is_enabled' => true]);
        return $query;
    }
```
