jsadways/authenticator

此包的最新版本(1.0.12)没有提供许可证信息。

1.0.12 2024-08-20 01:49 UTC

This package is auto-updated.

Last update: 2024-09-20 01:57:05 UTC


README

JsAuthenticate 是 Laravel 框架套件,用于用户认证管理。

功能

  • 登录 API
  • 用户 Middleware 验证

安装

  1. 下载套件
composer require jsadways/authenticator
  1. 将套件可配置配置复制到项目
php artisan vendor:publish --provider="Js\Authenticator\Providers\AuthServiceProvider"
  1. 在项目 .env 中添加账户验证网址与前端网址
JS_AUTH_HOST='http://authenticate.tw'
FORESTAGE_URL='http://172.16.1.156:3100/struct'

使用

  • 套件提供了 Middleware 验证功能,名称为 js-authenticate-middleware-alias,验证成功后会在请求中加入 user_id。
// 在需驗證位置加入 js-authenticate-middleware-alias 中間件
Route::middleware(['js-authenticate-middleware-alias'])->group(function () {
    // 路徑
});