narakode/fineauth
Composer 安装命令:
composer require narakode/fineauth
包简介
A simple authentication package for Laravel REST APIs.
README 文档
README
A simple authentication package for Laravel REST APIs.
Features
- Login
- Access Tokens
- Refresh Tokens
- Current Authenticated User
Requirements
- PHP ^8.3
- Laravel ^13
- Laravel Sanctum ^4.3
Installation
Install the package:
composer require narakode/fineauth
This package requires Laravel Sanctum. If you haven't installed it yet, run:
php artisan install:api
Usage
Register the authentication routes in your routes file (for example, routes/api.php):
use Narakode\FineAuth\FineAuth; FineAuth::routes();
You can verify that the routes have been registered by listing your application's routes:
php artisan route:list # Example: # POST api/login
Endpoints
Login
The POST /login endpoint requires the following request parameters:
emailpassword
The package uses Laravel's authentication system to validate the provided credentials.
If the credentials are invalid, it returns a 401 Unauthorized response:
{
"message": "The provided credentials do not match our records."
}
If authentication succeeds, it returns a 200 OK response:
{
"access_token": "xxxx",
"user": {
"id": "xxx",
"name": "xxx",
"email": "xxx"
}
}
A refresh token is also returned as an HTTP cookie named refresh_token with the following attributes:
- Expires in 1 hour
HttpOnlySecureSameSite
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2026-07-02