PHPackages                             fereydooni/laravel-sso - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. fereydooni/laravel-sso

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

fereydooni/laravel-sso
======================

A robust Single Sign-On (SSO) system for Laravel

041PHP

Since Apr 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Behnamfe76/laravel-sso)[ Packagist](https://packagist.org/packages/fereydooni/laravel-sso)[ RSS](/packages/fereydooni-laravel-sso/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel SSOAuth
===============

[](#laravel-ssoauth)

A robust Single Sign-On (SSO) system for Laravel applications using Laravel Passport for OAuth2 authentication, with optional social media authentication via Laravel Socialite and two-factor authentication (2FA).

Features
--------

[](#features)

- OAuth2 authentication using Laravel Passport
- Social media login via Laravel Socialite (Google, Facebook, Twitter, GitHub)
- Two-factor authentication via SMS and email channels
- Vue.js-based admin panel for managing OAuth2 applications
- Dedicated authentication page
- Support for SSO across multiple Laravel applications

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10.x
- Laravel Passport 11.x
- Laravel Socialite 5.x
- Vue 3.x (for admin panel and authentication page)

Installation
------------

[](#installation)

### 1. Composer Installation

[](#1-composer-installation)

```
composer require fereydooni/laravel-sso
```

### 2. Publish Configuration

[](#2-publish-configuration)

```
php artisan vendor:publish --provider="Fereydooni\LaravelSso\SSOAuthServiceProvider"
```

### 3. Run Migrations

[](#3-run-migrations)

```
php artisan migrate
```

### 4. Set Up Laravel Passport

[](#4-set-up-laravel-passport)

```
php artisan passport:install
```

### 5. Set Up Socialite Providers (Optional)

[](#5-set-up-socialite-providers-optional)

Add your Socialite provider credentials to the `config/sso-auth.php` configuration file.

### 6. Set Up Vue.js Components (Optional)

[](#6-set-up-vuejs-components-optional)

```
npm install
npm run dev
```

Configuration
-------------

[](#configuration)

Edit the `config/sso-auth.php` file to customize:

- OAuth2 settings
- Socialite providers
- Two-factor authentication
- Admin panel settings

Usage
-----

[](#usage)

### Basic Usage with Attributes

[](#basic-usage-with-attributes)

```
use Fereydooni\LaravelSso\Attributes\SSOAuth;
use Fereydooni\LaravelSso\Attributes\TwoFactorChannel;
use Fereydooni\LaravelSso\SSOManager;

#[SSOAuth(provider: 'oauth2', scopes: ['read', 'write'], twoFactor: true)]
#[TwoFactorChannel(channel: 'email', priority: 1)]
class AuthController extends Controller
{
    public function login(Request $request)
    {
        $manager = app(SSOManager::class);
        $user = $manager->authenticate('oauth2', $request);

        if ($manager->requiresTwoFactor($user)) {
            $manager->sendTwoFactorCode($user, 'email');
            return redirect()->route('2fa.verify');
        }

        return $manager->generateToken($user);
    }
}
```

### Social Authentication

[](#social-authentication)

```
#[SSOAuth(provider: 'socialite:google', scopes: ['profile'], twoFactor: true)]
#[TwoFactorChannel(channel: 'sms', priority: 1)]
public function googleLogin(Request $request)
{
    $manager = app(SSOManager::class);
    return $manager->redirectToProvider('google');
}

public function googleCallback(Request $request)
{
    $manager = app(SSOManager::class);
    $user = $manager->handleProviderCallback('google', $request);

    if ($manager->requiresTwoFactor($user)) {
        $manager->sendTwoFactorCode($user, 'sms');
        return redirect()->route('2fa.verify');
    }

    return $manager->generateToken($user);
}
```

### Admin Panel

[](#admin-panel)

Access the admin panel at `/sso/admin` to manage your OAuth2 clients.

### Authentication Page

[](#authentication-page)

Direct users to `/sso/login` for the authentication page.

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d9ae6dcf5d71a4eda508bc3b84bc78470548ebd7ed1824f3c194e03fd6815bfb?d=identicon)[Behnamfe76](/maintainers/Behnamfe76)

---

Top Contributors

[![Behnamfe76](https://avatars.githubusercontent.com/u/101217538?v=4)](https://github.com/Behnamfe76 "Behnamfe76 (10 commits)")

### Embed Badge

![Health badge](/badges/fereydooni-laravel-sso/health.svg)

```
[![Health](https://phpackages.com/badges/fereydooni-laravel-sso/health.svg)](https://phpackages.com/packages/fereydooni-laravel-sso)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
