PHPackages                             vdomah/jwtauth-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. vdomah/jwtauth-plugin

ActiveOctober-plugin[Authentication &amp; Authorization](/categories/authentication)

vdomah/jwtauth-plugin
=====================

JWTAuth plugin for October CMS wich provides token based authentication

279719[8 issues](https://github.com/vdomah/oc-jwtauth/issues)PHP

Since Apr 30Pushed 2y ago3 watchersCompare

[ Source](https://github.com/vdomah/oc-jwtauth)[ Packagist](https://packagist.org/packages/vdomah/jwtauth-plugin)[ RSS](/packages/vdomah-jwtauth-plugin/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

JWT Auth API
============

[](#jwt-auth-api)

JSON Web Token Authentication for your OctoberCMS API integrated with RainLab.User

This plugin provides token based authentication to your application. Is based on the awesome package [JSON Web Token Authentication for Laravel &amp; Lumen](https://github.com/tymondesigns/jwt-auth) by Sean Tymon.

### Requirements

[](#requirements)

RainLab.User plugin

### Installation

[](#installation)

1. \[NOT REQUIRED ANY MORE\] After plugin installation you need to copy /plugins/vdomah/jwtauth/config/auth.php to {root}/config/auth.php. If you want to change parameters values of auth.php you can use environment variables in .env (see "Environment options" section). {root}/config/auth.php is still supported and got priority highest then /plugins/vdomah/jwtauth/config/auth.php.
2. Generate JWT Authentication Secret. It will be used to sign your tokens. You got 2 options:

    - generate using command line: ```
        php artisan jwt:generate

        ```

        You need to assign the generated value to JWT\_SECRET in your .env.
    - go to Backend &gt; Settings &gt; JWTauth settings and click Generate Secret Key and save. This value has the highest priority and will override JWT\_SECRET value from .env.

Endpoints
---------

[](#endpoints)

The plugin provides 4 endpoints:

- /api/login

    Makes attempt to authenticate and returns token if succeeded. Also the basic user info is included in the response. By defult expects 2 parameters to receive: email and password.
- /api/signup

    Tries to create a user and returns token if succeeded. The user info is included in the response. By default expects 3 parameters to receive: email, password and password\_confirmation.
- /api/refresh

    Tries to refresh the token and return the new token. By default expects 1 parameter: token.
- /api/invalidate

    Tries to invalidate the given token - this can be used as an extra precaution to log the user out. By default expects 1 parameter: token.

Environment options
-------------------

[](#environment-options)

You're free to define any of this option in your project root .env.

### JWT config

[](#jwt-config)

VariableDefaultJWT\_SECRETJWT\_TTL60JWT\_REFRESH\_TTL20160JWT\_ALGOHS256JWT\_USER\_CLASSRainLab\\User\\Models\\UserJWT\_IDENTIFIERidJWT\_BLACKLIST\_ENABLEDtrueJWT\_PROVIDERS\_USERTymon\\JWTAuth\\Providers\\User\\EloquentUserAdapterJWT\_PROVIDERS\_JWTTymon\\JWTAuth\\Providers\\JWT\\NamshiAdapterJWT\_PROVIDERS\_AUTHTymon\\JWTAuth\\Providers\\Auth\\IlluminateAuthAdapterJWT\_PROVIDERS\_STORAGETymon\\JWTAuth\\Providers\\Storage\\IlluminateCacheAdapter### Laravel auth config

[](#laravel-auth-config)

VariableDefaultAUTH\_DEFAULT\_GUARDwebAUTH\_DEFAULT\_PASSWORDSusersAUTH\_GUARDS\_WEB\_DRIVERsessionAUTH\_GUARDS\_WEB\_PROVIDERusersAUTH\_GUARDS\_API\_DRIVERtokenAUTH\_GUARDS\_API\_PROVIDERusersAUTH\_PROVIDERS\_USERS\_DRIVEReloquentAUTH\_PROVIDERS\_USERS\_MODEL\\RainLab\\User\\Models\\UserAUTH\_PASSWORDS\_USERS\_PROVIDERusersAUTH\_PASSWORDS\_USERS\_EMAILauth.emails.passwordAUTH\_PASSWORDS\_USERS\_TABLEpassword\_resetsAUTH\_PASSWORDS\_USERS\_EXPIRE60Extending
---------

[](#extending)

### How to use this in another plugin?

[](#how-to-use-this-in-another-plugin)

Simply add `->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken')` to the end of the route in the plugin's routes.php

eg:

```
Route::post('test', function (\Request $request) {
   return response()->json(('The test was successful'));
})->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken');

```

Then when making the request set the header "Authorization" to "Bearer `{yourToken}`"

### How to define own set of user attributes in response?

[](#how-to-define-own-set-of-user-attributes-in-response)

For sign up and sign in add corresponding methods getAuthApiSignupAttributes or/and getAuthApiSigninAttributes to User model by extending it in your plugin's boot method:

```
    User::extend(function($model) {
        $model->addDynamicMethod('getAuthApiSignupAttributes', function () use ($model) {
            return [
                'my-attr' => $model->my_attr,
            ];
        });
    });

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 85.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/507b3e6ecd3fc6d829d8015dec612a94f6a4f4c66fdbe405d68e5eb1ad447374?d=identicon)[MatejGlasnak](/maintainers/MatejGlasnak)

---

Top Contributors

[![vdomah](https://avatars.githubusercontent.com/u/9612735?v=4)](https://github.com/vdomah "vdomah (23 commits)")[![bogandix](https://avatars.githubusercontent.com/u/4972194?v=4)](https://github.com/bogandix "bogandix (1 commits)")[![dleee](https://avatars.githubusercontent.com/u/28101040?v=4)](https://github.com/dleee "dleee (1 commits)")[![feber](https://avatars.githubusercontent.com/u/1727318?v=4)](https://github.com/feber "feber (1 commits)")[![jonoirwinrsa](https://avatars.githubusercontent.com/u/5059404?v=4)](https://github.com/jonoirwinrsa "jonoirwinrsa (1 commits)")

### Embed Badge

![Health badge](/badges/vdomah-jwtauth-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/vdomah-jwtauth-plugin/health.svg)](https://phpackages.com/packages/vdomah-jwtauth-plugin)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
