Download the PHP package desmart/jwt-auth without Composer
On this page you can find all versions of the php package desmart/jwt-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download desmart/jwt-auth
More information about desmart/jwt-auth
Files in desmart/jwt-auth
Package jwt-auth
Short Description Simple JWT auth implementation for Laravel.
License MIT
Informations about the package jwt-auth
Laravel JWT Auth
Simple JWT auth implementation for Laravel.
Installation
Install package using Composer:
Register the package's service provider in config/app.php
:
Configuration
The package comes with a config file. In order to publish it, run the following command:
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).
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
):
Now, simply use the auth
route middleware to check if a user is authenticated.
All versions of jwt-auth with dependencies
illuminate/support Version 5.4.*
illuminate/http Version 5.4.*
lcobucci/jwt Version ^3.2
illuminate/database Version 5.4.*