sameoldnick/laravel-oauth
Integrates Laravel Socialite with your app’s auth.
1,074
| Install | |
|---|---|
composer require sameoldnick/laravel-oauth |
|
| Latest Version: | v1.2.0 |
| PHP: | ^8.4 |
| Laravel: | 12 · 13 |
| Older releases: | 11 |
| License: | MIT |
| Last Updated: | Nov 5, 2026 |
| Links: | GitHub · Packagist |
Maintainer: SameOldNick
Laravel OAuth
Integrates Laravel Socialite with your app's authentication flow, including account linking, account relinking, registration/login gate checks, and stack-specific response handling.
Features
- Built-in OAuth flow routes and handlers
- Built-in clients: GitHub, Google, Twitter
- Uses
config/oauth.php(instead ofconfig/services.php) for provider credentials - Account linking table + model (
oauth_providers) - Install command to scaffold app-owned OAuth services and responses
- Contracts for full customization (gate checks, user resolver, registrar, response types)
- Events for connected/disconnected/signed-in lifecycle hooks
- Testing helpers via
OAuth::fake()
Requirements
- PHP 8.4+
- Laravel 11.x, 12.x, or 13.x
laravel/socialite5.27+
Installation
- Install the package:
composer require sameoldnick/laravel-oauth
- Publish config and migrations:
php artisan vendor:publish --tag=oauth-config
php artisan vendor:publish --tag=oauth-migrations
- Run migrations:
php artisan migrate
- Scaffold app-level OAuth services and responses:
php artisan oauth:install --stack=fortify
- Add provider credentials to
.env(examples):
GITHUB_OAUTH_ENABLED=true
GITHUB_CLIENT_ID=...
GITHUB_CLIENT_SECRET=...
GITHUB_REDIRECT_URI="${APP_URL}/oauth/callback/github"
GOOGLE_OAUTH_ENABLED=true
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
GOOGLE_REDIRECT_URI="${APP_URL}/oauth/callback/google"
TWITTER_OAUTH_ENABLED=true
TWITTER_CLIENT_ID=...
TWITTER_CLIENT_SECRET=...
TWITTER_REDIRECT_URI="${APP_URL}/oauth/callback/twitter"
# See the 'config/oauth.php' file for more environment variables.
- Ensure the generated app provider is registered.
The install command attempts to add App\Providers\OAuthServiceProvider::class to bootstrap/providers.php. If not added automatically, register it manually.
Wiki
All extended documentation lives in the wiki.
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
651,963,193
9,701
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
435,097,283
607
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v1.2.0 | ^8.4 | ^12.0|| | MIT | |
| v1.1.0 | ^8.4 | ^11.0|| | MIT | |
| v1.0.0 | ^8.4 | ^11.0|| | MIT |