Download the PHP package larawizards/lara-oauth2-client without Composer
On this page you can find all versions of the php package larawizards/lara-oauth2-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download larawizards/lara-oauth2-client
More information about larawizards/lara-oauth2-client
Files in larawizards/lara-oauth2-client
Package lara-oauth2-client
Short Description Laravel OAuth2 client package for single sign-on (SSO) authentication with Fortify/Jetstream integration
License MIT
Informations about the package lara-oauth2-client
Lara OAuth2 Client
A Laravel package for OAuth2 client authentication with single sign-on (SSO) support, compatible with Laravel 10, 11, and 12. Includes seamless integration with Laravel Fortify and Jetstream.
Features
- ๐ OAuth2 client implementation following industry best practices
- ๐ Single Sign-On (SSO) login page
- ๐ Laravel Fortify integration
- ๐ Laravel Jetstream integration
- ๐ฆ Laravel 10, 11, and 12 compatible
- ๐ Secure token storage with encryption
- ๐ค Automatic user creation/update
- ๐จ Beautiful, customizable SSO login page
- ๐งช Well-tested with PHPUnit
Installation
You can install the package via Composer:
Configuration
Quick Setup
-
Install the package:
-
Publish configuration:
-
Configure your
.envfile: - Run migrations:
Detailed Configuration
For complete configuration instructions, including:
- Step-by-step setup guide
- Configuration examples for popular providers (Google, Microsoft, GitHub, Auth0, Okta)
- Fortify/Jetstream integration setup
- Custom user mapping
- Advanced options
See CONFIGURATION.md for detailed instructions.
Usage
Basic Usage
The package automatically registers routes for OAuth2 authentication:
GET /oauth2/redirect- Redirects to OAuth2 providerGET /oauth2/callback- Handles OAuth2 callbackPOST /oauth2/logout- Logout and optionally revoke tokensGET /login/sso- SSO login page (if enabled)
Using the SSO Login Page
Simply redirect users to the SSO login route:
Or use the OAuth2 redirect directly:
Protecting Routes with Middleware
Use the oauth2.auth middleware to protect routes:
User Model Configuration
The package automatically maps OAuth2 user attributes to your user model. You can customize the mapping in config/lara-oauth2-client.php:
Make sure your user model has the necessary columns. You may need to create a migration:
Laravel Fortify Integration
-
Enable Fortify integration in your
.env: - The package will automatically integrate with Fortify's login views.
Laravel Jetstream Integration
-
Enable Jetstream integration in your
.env: -
Publish Jetstream views (if not already done):
- The package will add an SSO login button to your Jetstream login page.
Customizing Views
Publish the views to customize them:
Views will be published to resources/views/vendor/lara-oauth2-client/.
Programmatic Usage
You can also use the OAuth2 client directly:
Configuration Options
All configuration options are available in config/lara-oauth2-client.php:
| Option | Description | Default |
|---|---|---|
client_id |
OAuth2 client ID | - |
client_secret |
OAuth2 client secret | - |
redirect_uri |
OAuth2 redirect URI | /oauth2/callback |
authorization_url |
OAuth2 authorization endpoint | - |
token_url |
OAuth2 token endpoint | - |
user_info_url |
OAuth2 user info endpoint | - |
scopes |
OAuth2 scopes | ['openid', 'profile', 'email'] |
route_prefix |
Route prefix for OAuth2 routes | oauth2 |
auto_create_users |
Automatically create users if they don't exist | true |
fortify_enabled |
Enable Fortify integration | false |
jetstream_enabled |
Enable Jetstream integration | false |
sso_login_enabled |
Enable SSO login page | true |
Testing
Run the test suite:
Or with PHPUnit:
For detailed testing instructions, see TESTING.md.
Security Best Practices
- Always use HTTPS in production for OAuth2 redirects
- Store client secrets securely - never commit them to version control
- Use environment variables for all sensitive configuration
- Enable CSRF protection - the package uses Laravel's built-in CSRF protection
- Validate state parameters - the package automatically validates state to prevent CSRF attacks
- Encrypt tokens - access and refresh tokens are automatically encrypted in the database
Requirements
- PHP >= 8.2
- Laravel >= 10.0
- Guzzle HTTP Client
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
The MIT License (MIT). Please see License File for more information.
Support
For support, please open an issue on GitHub or contact [email protected].
All versions of lara-oauth2-client with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/routing Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0|^8.0