Download the PHP package iqbalatma/laravel-jwt-authentication without Composer
On this page you can find all versions of the php package iqbalatma/laravel-jwt-authentication. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-jwt-authentication
Laravel JWT Authentication
This is authentication for Laravel with JWT Based. Inspired by tymondesigns/jwt-auth and PHP-Open-Source-Saver/jwt-auth. This site was built using package from firebase/php-jwt for encode and decode JWT.
Next Feature
This is the lists of next feature
- [x] Using certificates on encode and decode JWT
- [x] Create command console for generate certificates
- [x] Set user on guard login
- [x] Reset user on guard logout
- [x] Add information on config jwt_iqbal
- [x] Rename config from jwt_iqbal into jwt
- [x] Rename guard from jwt-iqbal into jwt
- [] Implement testing
- [] Implement multi blacklist driver
How To Install
This package using syntax and feature that only available on php version at least 8.0
Publishing Asset
You can publish asset for customization using this command
Generate JWT Credentials
This credential is used for sign jwt token and make sure the token is valid
or using pairs of public and secret key
Configuration config/auth.php
Configuration config/jwt.php
Jwt signin using public and private key is first priority, so if you define private and public key, jwt will be signing using this key pairs. But if you do not define private and public key, jwt will use secret key for signing. If two type key does not exists, it will throw an error.
[!NOTE] Here is available algorithm if you're using secret key
- HS512
- HS256
- HS384
- HS224
[!NOTE] Here is available algorithm if you're using pairs of public and private key
- RS512
- RS256
- RS384
- ES384
- ES256
- ES256K
Implement JWTSubject
You need to implement Iqbalatma\LaravelJwtAuthentication\Interfaces\JWTSubject on User model. If you would like to add another additional data on jwt claim, you can return array on getJWTCustomClaims
How to use middleware ?
When you are doing authentication, you will receive 2 types token, access and refresh. Access token use to get protected resource, for example get data product, add new data user, etc. Access token has shorter ttl, so when access token expired, you can regenerate new token with refresh token. Endpoint that do refresh token must be protected by middleware type refresh. You can see the example on how to implement this middleware bellow
How to use ?
Here is some available method for authentication
Authenticate User
This feature used for validate credentials from user request and return back access_token and refresh_token
Logout User
This feature used for invalidate and blacklist current authorization token
Refresh Token
This feature used for invalidate access_token and refresh_token and invoke new access_token and refresh_token
Login By System
This method use for login existing user via authenticable instance
Get Token
After login or attempt method triggered and successfully, you can get token access and refresh via guard instance
Issued Token Service
This is a service related to issued token, access or refresh token. You can get list of issued token with their user-agent or revoke the token
All versions of laravel-jwt-authentication with dependencies
archtechx/enums Version ^1.0.0
ext-openssl Version *
php Version ^8.2