eightynine/easyauth
Composer 安装命令:
composer require eightynine/easyauth
包简介
Easy Auth SSO client plugin for Laravel and Filament apps.
README 文档
README
This guide is for a developer who has never wired SSO before. Follow the steps exactly.
Overview
Step 1: Create a client on the EasyAuth server
- Log in to the EasyAuth admin panel.
- Create a new OAuth client.
- Copy the Client ID and Client Secret.
- Add your app’s callback URL. Example:
The callback URL is provided by this package (it’s always your APP_URL + the callback route). You can also print it by running php artisan easyauth:install --publish.
You need these values for your app’s .env in Step 4.
Step 2: Install the plugin in your app
Run this in your Laravel/Filament app:
composer require eightynine/easyauth php artisan easyauth:install --publish
This adds the routes and publishes the config file.
Step 3: Ensure your app has sessions enabled
The plugin uses sessions to store the OAuth state, tokens, and login status. Make sure:
- Your app uses the
webmiddleware group. SESSION_DRIVERis set (database or file both work).
Step 4: Add the EasyAuth settings to your .env
Use the values from Step 1:
EASYAUTH_SERVER_URL=https://auth.example.com EASYAUTH_CLIENT_ID=your-client-id EASYAUTH_CLIENT_SECRET=your-client-secret
Everything else can be configured in config/easyauth.php (published in Step 2).
Step 5: Send users to /auth/login
This route is provided by the plugin. Example:
- Add a “Sign in with EasyAuth” button that links to
/auth/login.
When a user visits /auth/login, the plugin redirects them to:
Optional: use the built-in "Continue with Easy Auth" button
The plugin provides a Blade component you can drop into any Blade view:
<x-continue-with-easyauth />
This renders a branded button linking to route('sso.login').
Optional: override your app's login route
If you want /login (or other paths) to redirect into the EasyAuth flow, enable route overrides in config/easyauth.php:
'route_overrides' => [ 'enabled' => true, 'login_paths' => ['/login'], ],
Step 6: What happens on callback (automatic)
After login, EasyAuth redirects back to your callback URL with a code.
The plugin does this automatically:
- Exchanges the code for tokens at
/oauth/token. - Calls
/api/oauth/userinfoto fetch the user profile. - Finds or creates a local user.
- Logs the user into your app.
- Redirects to the intended URL, falling back to
easyauth.post_login_redirect.
You do not need to write this logic yourself.
Step 7: Logout
POST /auth/logout to:
- Log out locally.
- Redirect the user to EasyAuth logout.
Routes provided by the plugin
- /auth/login: start SSO
- /auth/callback: complete SSO (implemented by the plugin)
- /auth/refresh: refresh tokens
- /auth/logout: log out
- /auth/error: error screen
User mapping (when the user does not exist locally)
The plugin creates a local user using:
EASYAUTH_USER_IDENTIFIER(default: email)EASYAUTH_NAME_ATTRIBUTE(default: name)EASYAUTH_EMAIL_ATTRIBUTE(default: email)
If your users are matched by another field, set those keys in .env.
Common issues and fixes
- Redirect URI mismatch: the callback URL must exactly match what you registered.
- Invalid state: user opened the callback in a different browser or session expired.
- Userinfo failed: make sure the userinfo endpoint is reachable and scopes include
openid.
eightynine/easyauth 适用场景与选型建议
eightynine/easyauth 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 eightynine/easyauth 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 eightynine/easyauth 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-18