Download the PHP package lifewind/laravel-sso-client without Composer
On this page you can find all versions of the php package lifewind/laravel-sso-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lifewind/laravel-sso-client
More information about lifewind/laravel-sso-client
Files in lifewind/laravel-sso-client
Package laravel-sso-client
Short Description Laravel SSO client for LifeWind authentication
License MIT
Informations about the package laravel-sso-client
LifeWind Laravel SSO Client
API-only SSO authentication for Laravel backends.
This package provides secure JWT-based authentication endpoints for validating OAuth tokens from frontend applications.
๐ Features
- โ API-Only Architecture: Pure JSON endpoints, no redirects
- โ JWT Authentication: Secure token-based authentication
- โ OAuth 2.0 Flow: Industry standard OAuth implementation
- โ User Management: Automatic user creation and updates
- โ CORS Ready: Cross-domain frontend support
- โ Frontend Agnostic: Works with Vue, React, Angular, or any frontend
๐ Prerequisites: Register Your App in LifeWind Core
Before installing this package, you need an OAuth client registered in LifeWind Core:
- Login to the LifeWind Core admin panel at
https://lifewind-core.test/admin(or your production URL) - Navigate to OAuth Clients โ Create Client
- Fill in:
- Name: Your app name (e.g. "Atlas")
- Redirect URI: Your frontend callback URL (e.g.
https://your-app.com/sso/callback) - Grant Type: Authorization Code
- After creation, copy the Client ID and Client Secret โ you'll need these for your
.env
Tip: For local development, use
http://localhost:3001/sso/callbackas the redirect URI (adjust port to match your frontend dev server).
๐ Quick Start
1. Installation
2. Configuration
Publish configuration and run migrations:
3. Environment Setup
4. CORS Configuration
Update config/cors.php:
๐ก API Endpoints
The package automatically registers these endpoints:
| Method | Endpoint | Description |
|---|---|---|
POST |
/sso/validate |
Validate OAuth code โ return JWT + user |
GET |
/sso/user |
Get authenticated user (Bearer token) |
POST |
/sso/refresh |
Refresh JWT token |
POST /sso/validate
Exchange OAuth authorization code for JWT token.
Request:
Success Response (200):
Error Response (400):
GET /sso/user
Get current authenticated user information.
Headers:
Success Response (200):
Error Response (401):
POST /sso/refresh
Refresh an existing JWT token.
Headers:
Success Response (200):
๐ Protecting Routes
Use the built-in middleware to protect your API routes:
๐ ๏ธ Using in Controllers
Access the authenticated user in your controllers:
๐ง Advanced Configuration
Custom User Model
If you're using a custom User model:
JWT Configuration
OAuth Scopes
Database Configuration
๐งช Testing & Debugging
Test Command
Manual Testing
Test the endpoints manually:
๐ Frontend Integration
This package is designed for frontend-initiated OAuth flows:
Flow Overview
- Frontend redirects user to LifeWind OAuth provider
- LifeWind authenticates user and redirects back to frontend
- Frontend captures authorization code from callback URL
- Frontend sends code to your backend's
/sso/validateendpoint - Backend validates code with LifeWind and returns JWT + user data
- Frontend stores JWT token for subsequent API requests
For Vue.js Applications
Use our companion Vue.js package:
For Other Frontends
Implement the OAuth flow manually:
๐จ Production Checklist
Security Requirements
- [ ] HTTPS Only: Both frontend and backend must use HTTPS
- [ ] Strong JWT Secret: Use a secure 256-bit random key
- [ ] CORS Origins: Only allow your actual frontend domains
- [ ] Environment Variables: All secrets properly configured
- [ ] SSL Verification: Enable SSL verification for OAuth requests
Example Production Configuration
Performance Optimization
๐ Troubleshooting
Common Issues
"Invalid authorization code" error:
- Check that
LIFEWIND_SSO_REDIRECT_URImatches exactly what you registered - Ensure the authorization code hasn't expired (usually 10 minutes)
- Verify the
redirect_urisent to/sso/validatematches OAuth registration
CORS errors:
- Add your frontend domain to
config/cors.php - Ensure
Access-Control-Allow-Credentialsis properly configured - Check that preflight OPTIONS requests are handled
JWT token invalid:
- Verify
LIFEWIND_SSO_JWT_SECRETis the same across all app instances - Check token hasn't expired (
expires_inseconds) - Ensure Bearer token format:
Authorization: Bearer <token>
Debug Logging
Enable detailed logging in development:
Check logs at:
๐ License
MIT License. See LICENSE for details.
๐ค Support
- Documentation: https://docs.lifewind.com/laravel-sso
- Issues: GitHub Issues
- Email: [email protected]
Built for modern API-first applications ๐
All versions of laravel-sso-client with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/auth Version ^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.5
firebase/php-jwt Version ^6.0