beardedandnotmuch/yii2-jwt-user

There is no license information available for the latest version (dev-master) of this package.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 2

Type:yii2-extension

dev-master 2025-09-11 14:18 UTC

This package is not auto-updated.

Last update: 2025-09-12 12:25:30 UTC


README

Yii2 module which allows to authenticate users by using JWT tokens

Under development.

No tests yet.

Example of config

...
'modules' => [
    'auth' => [
        'class' => 'beardedandnotmuch\user\Module',
        'viewPath' => '@frontend/views',
        'forceLogin' => true,
        'duration' => function () {
          return is_mobile() ? false : 24 * 60 * 60;
        },
        'modelMap' => [
            'User' => 'frontend\models\User',
            'LoginForm' => 'frontend\models\LoginForm',
            'ReplacePasswordForm' => 'frontend\models\ReplacePasswordForm',
            'ResetPasswordForm' => 'frontend\models\ResetPasswordForm',
            'RegistrationForm' => [
                'class' => 'frontend\models\RegistrationForm',
                'key' => $params['registration.salt'],
            ],
        ],
        'on beforeLogin' => ['frontend\helpers\EventsHelper', 'beforeLogin'],
        'on afterLogin' => ['frontend\helpers\EventsHelper', 'afterLogin'],
        'on afterLogout' => ['frontend\helpers\EventsHelper', 'afterLogout'],
        'on afterRegistration' => ['frontend\helpers\EventsHelper', 'afterRegistration'],
        'on sendResetPassword' => ['frontend\helpers\EventsHelper', 'sendResetPassword'],
    ],
],
...

Default routes

GET|PUT /api/user

POST|DELETE /api/user/session

POST /api/user/auth

PUT /api/user/password
POST|PUT /api/user/password/reset

POST confirm
POST heartbeat