Download the PHP package sengheat/laravel-sso without Composer
On this page you can find all versions of the php package sengheat/laravel-sso. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-sso
sengheat/sso-token
A Laravel SSO package — one central auth-service issues tokens, every other service verifies them without HTTP calls.
How It Works
Installation
Part 1 — Auth Service (Issuer)
The service that owns the users table and issues tokens.
1. Enable issuer mode in .env
2. Publish and configure config/sso.php
3. Add HasSSOProfile trait to User model
4. Add api guard to config/auth.php
5. Run migration
Adds to users table: sso_provider, sso_provider_id, sso_token, sso_avatar, api_token (indexed).
Available routes (auto-registered)
| Method | URI | Description |
|---|---|---|
| GET | /sso/login |
Login page (form) |
| POST | /sso/login |
Process login |
| GET | /sso/register |
Register page |
| POST | /sso/register |
Process register |
| POST | /api/sso/login |
API login → {user, token} |
| POST | /api/sso/register |
API register → {user, token} |
| POST | /api/sso/exchange |
Exchange one-time code → {user, token} |
| POST | /api/sso/logout |
Revoke token |
| GET | /api/sso/user |
Current user info |
Part 2 — Other Services (Consumers)
Order service, product service, any service that needs to verify tokens.
1. Install package
2. Add auth_db connection to config/database.php
3. Add sso guard to config/auth.php
4. User model — points to auth_db
5. Register middleware in bootstrap/app.php
6. Protect routes
7. .env
How token verification works
PostgreSQL security (production)
Part 3 — Web Portal (Next.js / React)
Token is never visible in the URL. A 30-second one-time code is used instead.
Flow
Step 1 — Redirect to auth-service
Step 2 — Callback page (/sso/callback)
Step 3 — Use token on any service
.env.local
Part 4 — Mobile App (React Native / Flutter)
Mobile calls the API endpoints directly — no browser redirect needed.
Login
Store token securely (iOS Keychain / Android Keystore).
Use token on any service
Logout
React Native
Flutter
Trait Helpers
Security Summary
| Concern | Solution |
|---|---|
| Token in URL | One-time code exchange — token never in URL |
| Token storage | SHA256 hash in DB — plain token only in HTTP response |
| Open redirect | SSO_ALLOWED_REDIRECTS whitelist |
| DB access | Dedicated read-only PostgreSQL user per service |
| Network | pg_hba.conf IP whitelist on auth_db port |
| Brute force | throttle:20,1 on login routes |
| Cache | Redis with TTL — stale tokens auto-expire |
Environment Variables Reference
| Variable | Service | Default | Description |
|---|---|---|---|
SSO_FORM_AUTH |
Issuer | false |
Enable built-in login/register |
SSO_FORM_AUTH_REGISTER |
Issuer | true |
Allow new registrations |
SSO_ALLOWED_REDIRECTS |
Issuer | — | Comma-separated portal callback URLs |
SSO_REDIRECT_AFTER_LOGIN |
Issuer | /dashboard |
Fallback redirect after login |
SSO_REDIRECT_AFTER_LOGOUT |
Issuer | /sso/login |
Redirect after logout |
SSO_CACHE_STORE |
Consumer | null (default) |
Cache driver: redis, file |
SSO_TOKEN_CACHE_TTL |
Consumer | 300 |
Token cache TTL in seconds |
AUTH_DB_HOST |
Consumer | 127.0.0.1 |
Auth-service DB host |
AUTH_DB_PORT |
Consumer | 5432 |
Auth-service DB port |
AUTH_DB_DATABASE |
Consumer | auth_service |
Auth-service DB name |
AUTH_DB_USERNAME |
Consumer | — | Read-only DB user |
AUTH_DB_PASSWORD |
Consumer | — | DB password |
License
MIT — Seng Heat
All versions of laravel-sso with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
laravel/socialite Version ^5.0