New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

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

codecov Packagist Downloads Packagist Version GitHub Actions Workflow Status

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 of config/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/socialite 5.27+

Installation

  1. Install the package:
composer require sameoldnick/laravel-oauth
  1. Publish config and migrations:
php artisan vendor:publish --tag=oauth-config
php artisan vendor:publish --tag=oauth-migrations
  1. Run migrations:
php artisan migrate
  1. Scaffold app-level OAuth services and responses:
php artisan oauth:install --stack=fortify
  1. 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.
  1. 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

sameoldnick/laravel-backup-manager

Database-driven backup management for Laravel.

1,280 0
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

651,963,193 9,701
laravel/framework

The Laravel Framework.

610,364,751 34,988
laravel/tinker

Powerful REPL for the Laravel framework.

518,004,183 7,444
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||^13.0 MIT
v1.1.0 ^8.4 ^11.0||^12.0||^13.0 MIT
v1.0.0 ^8.4 ^11.0||^12.0||^13.0 MIT