Download the PHP package geniusauth/laravel without Composer
On this page you can find all versions of the php package geniusauth/laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download geniusauth/laravel
More information about geniusauth/laravel
Files in geniusauth/laravel
Package laravel
Short Description Official Laravel SDK for GeniusAuth OpenID Connect authentication.
License MIT
Homepage https://docs.geniusauth.com
Informations about the package laravel
✨ Features
- Passwordless authentication — Passkeys and WebAuthn, no passwords stored
- OAuth 2.1 with PKCE — Authorization Code flow with Proof Key for Code Exchange
- OpenID Connect — ID token validation via JWKS with issuer, audience, nonce, and state verification
- Auto-discovery — Service provider and facade registered automatically
- Middleware included — Protect routes with a single
geniusauthmiddleware alias - Session management — Secure session-backed user identity with token storage
- Zero dependencies on passwords — Cryptographic authentication only
- Domain-Driven Design — Contracts, DTOs, Exceptions, Infrastructure, and Services in a modular architecture
- Interface-driven — All services are bound to interfaces for full testability and swappability
📦 Installation
The service provider is auto-discovered by Laravel. No manual registration needed.
⚙️ Configuration
Create an application in the GeniusAuth dashboard, then set your credentials in .env:
Config options
| Key | Default | Description |
|---|---|---|
issuer |
https://auth.geniuspay.tech |
GeniusAuth OIDC issuer URL |
client_id |
— | Your application client ID |
client_secret |
— | Your application client secret |
redirect_uri |
— | Callback URL registered in the dashboard |
scopes |
['openid', 'profile', 'email'] |
OpenID Connect scopes to request |
session_key |
geniusauth.user |
Session key for the authenticated identity |
🚀 Quick Start
1. Protect routes
2. Trigger sign-in
3. Access the authenticated user
4. Logout
🔄 How it works
🛣️ Identity Linking
The SDK includes built-in support for bidirectional identity linking between your application and GeniusAuth. This lets users connect their GeniusAuth account to your app from either side.
How it works
Configuration
Add these to your .env:
The sync_api_key is generated when you register your app in GeniusAuth. It authenticates calls to the POST /api/sync endpoint.
Registered routes
The SDK automatically adds these routes for linking:
| Method | URI | Name | Description |
|---|---|---|---|
GET |
/geniusauth/link |
geniusauth.link |
Receives the redirect from GeniusAuth, stores state, authenticates user if needed |
GET |
/auth/genius/link/complete |
geniusauth.link.complete |
Post-OIDC-callback handler that completes a pending link |
Usage
From GeniusAuth (user initiates on connected-apps page)
GeniusAuth redirects to your app's link_url (configured in the GeniusAuth dashboard). The SDK handles everything automatically — no code needed.
From your app (user initiates locally)
Custom link URL
By default the SDK registers /geniusauth/link. To use a custom controller instead, set GENIUSAUTH_LINK_URL in your .env and register your own route. The GeniusAuth dashboard should point to whatever URL you configure.
The package automatically registers these routes:
| Method | URI | Name | Description |
|---|---|---|---|
GET |
/auth/genius |
geniusauth.login |
Redirects to GeniusAuth authorization endpoint |
GET |
/auth/genius/callback |
geniusauth.callback |
Handles the OAuth callback and token exchange |
POST |
/auth/genius/logout |
geniusauth.logout |
Clears session and invalidates tokens |
📚 API Reference
Facades
| Method | Returns | Description |
|---|---|---|
GeniusAuth::redirect() |
RedirectResponse |
Starts OAuth 2.1 Authorization Code flow with PKCE |
GeniusAuth::user() |
array\|null |
Returns the session-backed authenticated identity |
GeniusAuth::logout() |
void |
Clears GeniusAuth tokens and invalidates the session |
GeniusAuthLink::handleLinkRequest($request) |
RedirectResponse |
Handles incoming link redirect from GeniusAuth |
GeniusAuthLink::completeLink($request) |
RedirectResponse\|null |
Completes a pending link after OIDC callback |
Contracts (for dependency injection)
| Interface | Methods | Default implementation |
|---|---|---|
OidcClientInterface |
redirect(), handleCallback(), user(), logout() |
OidcClientService |
TokenValidatorInterface |
validateIdentityToken() |
OidcTokenValidator |
LinkFlowInterface |
handleLinkRequest(), completeLink() |
LinkFlowService |
SyncClientInterface |
syncToGeniusAuth(), lookupByGeniusId() |
GeniusAuthSyncClient |
StaffSyncInterface |
syncFromClaims() |
StaffSyncService |
UserRepositoryInterface |
findByEmailOrGeniusId(), create(), getRoleMapping() |
ConfigUserRepository |
Example: Complete controller
🏗️ Architecture
The SDK follows a modular Domain-Driven Design (DDD) architecture:
Extending the SDK
All services are bound to interfaces. You can override any binding in your own service provider:
Backward compatibility
Concrete class aliases are registered for backward compatibility but are deprecated and will be removed in v1.0. Inject the interface instead.
🔒 Security
- OAuth 2.1 Authorization Code + PKCE — No implicit flow, no client secrets in URLs
- JWKS validation — ID tokens verified against the issuer's JSON Web Key Set
- Claim verification — Issuer, audience, nonce, and state validated on every callback
- No passwords — Authentication relies exclusively on cryptography (WebAuthn) and one-time links
- Session regeneration — Token invalidation and CSRF token regeneration on logout
Never commit client secrets. Report vulnerabilities privately as described in SECURITY.md.
🧩 Compatibility
| Requirement | Version |
|---|---|
| PHP | 8.3, 8.4 |
| Laravel | 11, 12 |
🤝 Contributing
See Conventional Commits and run:
📄 License
GeniusAuth Laravel SDK is open-sourced software licensed under the MIT license.
All versions of laravel with dependencies
firebase/php-jwt Version ^7.0
illuminate/contracts Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
illuminate/routing Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0