PHPackages                             omniglies/laravel-sso-client - 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. omniglies/laravel-sso-client

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

omniglies/laravel-sso-client
============================

Laravel package for OAuth client using Laravel Socialite with LaravelPassport driver

v12.0.10(9mo ago)0171MITPHPPHP ^8.2CI passing

Since Jul 23Pushed 9mo agoCompare

[ Source](https://github.com/aanfarhan/laravel-sso-client)[ Packagist](https://packagist.org/packages/omniglies/laravel-sso-client)[ RSS](/packages/omniglies-laravel-sso-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (56)Used By (0)

Laravel SSO Client
==================

[](#laravel-sso-client)

A Laravel package for OAuth client implementation using Laravel Socialite with LaravelPassport driver.

Features
--------

[](#features)

- Easy SSO integration with LaravelPassport OAuth server
- Automatic user synchronization from OAuth server
- Configurable user model and field preservation
- Support for Spatie Laravel Permission roles
- Artisan command for easy installation and setup
- Local and SSO logout options

Version Compatibility
---------------------

[](#version-compatibility)

Laravel VersionPackage VersionPHP VersionBranchStatus12.x^12.0^8.2mainActive Development11.x^11.0^8.211.xActive Maintenance10.x^10.0^8.110.xActive Maintenance9.x^9.0^8.09.xLTS / Security FixesInstallation
------------

[](#installation)

### Via Composer

[](#via-composer)

#### Laravel 12.x (Latest)

[](#laravel-12x-latest)

```
composer require omniglies/laravel-sso-client
```

#### Laravel 11.x

[](#laravel-11x)

```
composer require omniglies/laravel-sso-client:^11.0
```

#### Laravel 10.x

[](#laravel-10x)

```
composer require omniglies/laravel-sso-client:^10.0
```

#### Laravel 9.x

[](#laravel-9x)

```
composer require omniglies/laravel-sso-client:^9.0
```

### Quick Setup

[](#quick-setup)

Run the installation command to automatically configure everything:

```
php artisan sso:install
```

This command will:

- Publish configuration files
- Publish database migrations
- Configure required services
- Update EventServiceProvider
- Add environment variables template

### Manual Installation

[](#manual-installation)

1. Publish the configuration:

```
php artisan vendor:publish --tag=sso-client-config
```

2. Publish migrations:

```
php artisan vendor:publish --tag=sso-client-migrations
```

3. Run migrations:

```
php artisan migrate
```

4. Add to your `.env` file:

```
LARAVELPASSPORT_CLIENT_ID=your_client_id
LARAVELPASSPORT_CLIENT_SECRET=your_client_secret
LARAVELPASSPORT_REDIRECT_URI=http://your-app.com/sso/callback
LARAVELPASSPORT_HOST=http://your-oauth-server.com
```

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

[](#configuration)

### config/sso-client.php

[](#configsso-clientphp)

```
return [
    // User model to use for authentication
    'user_model' => 'App\\Models\\User',

    // Default role for new SSO users (requires Spatie Permission)
    'default_role' => null,

    // Fields that won't be overwritten during sync
    'preserved_fields' => [
        'id_role', 'nik', 'address', 'nip_pbb',
        'kd_propinsi', 'kd_dati2', 'kd_kecamatan', 'kd_kelurahan'
    ],

    // Redirect path after successful login
    'redirect_after_login' => '/home',

    // Route configuration
    'route_prefix' => 'sso',
    'middleware' => ['web'],
];
```

Usage
-----

[](#usage)

### Routes

[](#routes)

The package automatically registers these routes:

- `GET /sso/redirect` - Redirect to OAuth server
- `GET /sso/callback` - OAuth callback handler
- `POST /sso/logout` - SSO logout (logs out from both local and OAuth server)
- `POST /sso/local-logout` - Local logout only

### In your views

[](#in-your-views)

```
{{-- SSO Login Button --}}

    Login with SSO

{{-- SSO Logout Button --}}

    @csrf

        Logout (SSO)

{{-- Local Logout Only --}}

    @csrf

        Logout (Local Only)

```

### User Service

[](#user-service)

Access the SSO user service for advanced operations:

```
use Omniglies\LaravelSsoClient\Services\SsoUserService;

$ssoService = new SsoUserService();

// Search users (requires admin token)
$users = $ssoService->withToken($adminToken)->searchUsers(['email' => 'user@example.com']);

// Create user on OAuth server
$newUser = $ssoService->withToken($adminToken)->createUser([
    'name' => 'John Doe',
    'email' => 'john@example.com',
    'username' => 'johndoe',
    'password' => 'password'
]);

// Sync local user with OAuth server
$ssoService->syncLocalUser($user);
```

Database Schema
---------------

[](#database-schema)

The package adds these fields to your users table:

- `oauth_id` - Unique OAuth user ID
- `username` - Username from OAuth server
- `oauth_data` - JSON field storing all OAuth user data
- `synced_at` - Last sync timestamp
- `is_active` - User active status

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

[](#requirements)

This package supports multiple Laravel versions with different requirements:

### Laravel 12.x (main branch)

[](#laravel-12x-main-branch)

- PHP ^8.2
- Laravel ^12.0
- Laravel Socialite ^5.0
- SocialiteProviders LaravelPassport ^4.0

### Laravel 11.x (11.x branch)

[](#laravel-11x-11x-branch)

- PHP ^8.2
- Laravel ^11.0
- Laravel Socialite ^5.0
- SocialiteProviders LaravelPassport ^4.0

### Laravel 10.x (10.x branch)

[](#laravel-10x-10x-branch)

- PHP ^8.1
- Laravel ^10.0
- Laravel Socialite ^5.0
- SocialiteProviders LaravelPassport ^4.0

### Laravel 9.x (9.x branch)

[](#laravel-9x-9x-branch)

- PHP ^8.0
- Laravel ^9.0
- Laravel Socialite ^5.0
- SocialiteProviders LaravelPassport ^4.0

License
-------

[](#license)

MIT License

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance56

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~0 days

Total

55

Last Release

288d ago

Major Versions

v10.0.10 → v11.0.102025-07-23

v9.0.14 → v12.0.92025-07-25

9.x-dev → 10.x-dev2025-07-28

v10.0.12 → v11.0.122025-07-28

11.x-dev → v12.0.102025-07-28

PHP version history (3 changes)v12.0.0PHP ^8.2

v10.0.0PHP ^8.1

v9.0.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![aanfarhan](https://avatars.githubusercontent.com/u/19621476?v=4)](https://github.com/aanfarhan "aanfarhan (23 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[socialiteproviders/manager

Easily add new or override built-in providers in Laravel Socialite.

42442.0M544](/packages/socialiteproviders-manager)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

34450.0k2](/packages/andrewdwallo-filament-companies)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)[pschocke/laravel-telegram-login-widget

Easily integrate Telegrams login widget into your Laravel application to send Telegram messages

1610.4k](/packages/pschocke-laravel-telegram-login-widget)

PHPackages © 2026

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