desmart/jwt-auth
Larablocks Analysis
desmart/jwt-auth works with Laravel 5 (latest release 1.0.4, Nov 24, 2017), which reached end of life: no more fixes, even for security.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- Supports only Laravel 5, past end of life
- No release in the last 12 months (last: Nov 24, 2017)
- 0 downloads a month (needs 10,000)
- 0 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Nov 24, 2017.
- No releases in the last 12 months.
- First released: Nov 12, 2016.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 2, 2026.
| Install | |
|---|---|
composer require desmart/jwt-auth |
|
| Latest Version: | 1.0.4 |
| PHP: | >=7.0.0 |
| Laravel: | 5 |
| License: | MIT |
| Last Updated: | Nov 24, 2017 |
| Links: | GitHub · Packagist |
Laravel JWT Auth
Simple JWT auth implementation for Laravel.
Installation
Install package using Composer:
composer require desmart/jwt-auth
Register the package's service provider in config/app.php:
'providers' => [
(...)
DeSmart\JWTAuth\ServiceProvider::class,
],
Configuration
The package comes with a config file. In order to publish it, run the following command:
php artisan vendor:publish
The config file allows you to change some options. Be sure to check it out.
Usage
The package allows to:
- Authenticate a user,
- Verify if the user is authenticated using route middleware.
User authentication
First, add the TokenRefreshMiddleware as a global middleware or to a middleware group (app/Http/Kernel.php). It will add the Authorization header to the response. This header will contain the JWT token, after successful authentication.
Then, inject \DeSmart\JWTAuth\Auth\Guard into your auth class and authenticate the user (credentials validation is up to you).
public function authenticateUser(\DeSmart\JWTAuth\Auth\Guard $auth, $user) {
if (true === $this->validateCredentails($user)) {
$auth->loginUser($user);
}
}
Token verification
Once a user has been authenticated, each request to your application should contain the Authorization header with the token obtained after succesful authentication.
Add AuthMiddleware to the your $routeMiddleware array (app/Http/Kernel.php):
protected $routeMiddleware = [
(...)
'auth' => \DeSmart\JWTAuth\Middleware\AuthMiddleware::class,
];
Now, simply use the auth route middleware to check if a user is authenticated.
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.0.4 | >=7.0.0 | 5.4.* | MIT | |
| 1.0.3 | >=7.0.0 | 5.4.* | MIT | |
| 1.0.2 | >=7.0.0 | 5.4.* | MIT | |
| 1.0.1 | >=7.0.0 | 5.4.* | MIT | |
| 1.0.0 | >=7.0.0 | 5.4.* | MIT | |
| 0.2.1 | >=7.0.0 | 5.3.* | MIT | |
| 0.2.0 | >=7.0.0 | 5.3.* | MIT | |
| 0.1.0 | >=7.0.0 | 5.3.* | MIT |