sameoldnick/laravel-oauth

Integrates Laravel Socialite with your app’s auth.

Maintainers

Package info

github.com/SameOldNick/laravel-oauth

Homepage

pkg:composer/sameoldnick/laravel-oauth

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-06-03 23:52 UTC

This package is auto-updated.

Last update: 2026-06-04 00:12:40 UTC


README

codecov

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"
  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.