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

ActiveLaravel-package[Authentication &amp; Authorization](/categories/authentication)

rizalrepo/sso-client
====================

SSO Client OAuth 2.0

v1.3.3(2mo ago)0147MITPHPPHP ^7.4|^8.0

Since May 17Pushed 2mo ago1 watchersCompare

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

READMEChangelog (6)DependenciesVersions (7)Used By (0)

Client Usage Config
===================

[](#client-usage-config)

**Current release:** [v1.3.3](md/RELEASE_NOTES_v1.3.3.md) – OAuth hardening, avatar, role-based redirect. [Changelog](md/CHANGELOG.md)

\#installation

```
composer require rizalrepo/sso-client

```

Configuration
=============

[](#configuration)

publish SSOController with run command

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

```

Connect with SSO
================

[](#connect-with-sso)

open config/sso.php and adjust config with your preference

```
return [
    'callbackUrl' => "http://127.0.0.1:8000/callback",
    'serverUrl' => "http://127.0.0.1:8081",
    'clientId' => "f9c2bbad-c06d-4028-9786-213c9113ddbb",
    'clientSecret' => "1zJyzTcLmL05ZzMOnaMI6DfhaY9guJLCKBisH4YS",
];

```

Routes
======

[](#routes)

add code to web.php

```
Route::controller(SSOController::class)->group(function () {
    Route::get("/", 'ssoPage');
    Route::get("/sso/login", 'getLogin')->name("sso.login");
    Route::get("/callback", 'getCallback')->name("sso.callback");
    Route::get("/sso/connect", 'connectUser')->name("sso.connect");

    Route::middleware('auth')->group(function () {
        Route::get("/sso/logout", 'logout')->name("sso.logout");
        Route::get("/sso/edit-password", 'editPassword')->name("sso.edit-password");
        Route::get("/sso/portal", 'portal')->name("sso.portal");
        Route::get("/sso/profile", 'editProfile')->name("sso.profile");
    });
});

```

Table
=====

[](#table)

modify file users migration with :

```
Schema::create('users', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->string('username')->unique();
    $table->string('phone')->unique();
    $table->char('prodi', 5)->nullable();
    $table->bigInteger('oauth_client_role_id');
    $table->timestamp('email_verified_at')->nullable();
    $table->rememberToken();
    $table->timestamps();
});

```

Middleware Settings
===================

[](#middleware-settings)

- for Laravel 11 add command :

```
php artisan make:middleware Authenticate

```

- then update code bellow to Middleware/Authenticate.php and adjust config with your preference

```
