dweik/laravel-guard-jwt-validator
最新稳定版本:1.0.2
Composer 安装命令:
composer require dweik/laravel-guard-jwt-validator
包简介
Laravel guard for validate JWT token
README 文档
README
This package used for microservices to validate the JWT access token and create user if is not exists. It built on Laravel Guard model, so developer could use the auth config and helper to setup the packager programmer.
Install
Require this package with composer using the following command:
composer require dweik/laravel-guard-jwt-validator
Then you need publish the config files by execute the following command
php artisan vendor:publish --tag=laravel-guard-jwt-config
Then you have set up the JWT configuration values in config/jwt.php, and add the follow values
in config/auth.php to add new guard to laravel project
'guards' => [
.
.
// add under guards value
'jwt' => [
'driver' => 'jwt',
'provider' => 'guard-jwt',
],
]
'providers' => [
.
.
// add under providers value
'guard-jwt' => [
'driver' => 'guard-jwt',
'model' => \App\Models\User::class
],
]
How to use
you can add guard to middleware or use it as default guard by changing the defaults value in config/auth.php
Changelog
V1.0.1
- [bugfix] return an exception
Token not validif token not passed
V1.0.0
- Validate the JWT token
- Create user if is not exists by using the JWT payload values
统计信息
- 总下载量: 377
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-16