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

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

ums-lspl/sso-client
===================

Laravel client package for SmartExam SSO — verify tokens and authenticate users in consumer apps.

v1.0.6(1mo ago)031↓48.6%MITPHPPHP ^8.1

Since Jun 10Pushed 1mo agoCompare

[ Source](https://github.com/rajkumarchanda/ums-sso-client)[ Packagist](https://packagist.org/packages/ums-lspl/sso-client)[ Docs](https://github.com/rajkumarchanda/ums-sso-client)[ RSS](/packages/ums-lspl-sso-client/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (9)Versions (8)Used By (0)

ums-lspl/sso-client
===================

[](#ums-lsplsso-client)

Laravel package for consumer apps that sign users in with **SmartExam SSO**.

SmartExam issues a signed token after the user approves login. This package verifies the token, creates or updates a local user, and starts a Laravel session.

**Requirements:** PHP 8.1+, Laravel 9–13, and an SSO application in **SmartExam Admin → SSO → Applications**.

---

Quick start
-----------

[](#quick-start)

### 1. Install

[](#1-install)

```
composer require ums-lspl/sso-client
php artisan vendor:publish --tag=smartexam-sso-config
php artisan vendor:publish --tag=smartexam-sso-migrations
php artisan migrate
```

This adds a nullable, unique `smartexam_id` column to `users`.

### 2. Configure `.env`

[](#2-configure-env)

```
SMARTEXAM_URL=https://your-ums-server.example.com
SSO_CLIENT_KEY=your-client-key
SSO_CLIENT_SECRET=your-client-secret
SSO_CALLBACK_URL=https://your-app.example.com/sso/callback
SSO_AFTER_LOGIN_REDIRECT=/
```

Register the same `SSO_CALLBACK_URL` in SmartExam Admin for your client key.

### 3. Update your User model

[](#3-update-your-user-model)

```
protected $fillable = [
    // ...
    'smartexam_id',
];
```

### 4. Add SSO to your login page

[](#4-add-sso-to-your-login-page)

In your auth layout ``:

```

```

In the layout body (no publish step needed):

```
@include('smartexam-sso::login-script')
```

On your login button:

```
Sign in with SmartExam
```

That’s it. The partial loads the SmartExam overlay, stores CSRF state, opens the popup, and POSTs to the exchange route.

---

How it works
------------

[](#how-it-works)

 ```
sequenceDiagram
    participant Browser
    participant App as Your Laravel app
    participant UMS as SmartExam

    Browser->>App: Open login page
    Browser->>UMS: Popup — user approves SSO
    UMS->>Browser: Redirect popup to /sso/callback
    Browser->>App: POST /api/sso/exchange
    App->>App: Verify token, login user
    Browser->>App: Redirect to dashboard
```

      Loading **Recommended:** popup + exchange (`POST /api/sso/exchange`) — handled by `@include('smartexam-sso::login-script')`.

**Alternative:** full browser redirect to `GET /sso/callback` (no popup, no JavaScript).

---

Publish tags
------------

[](#publish-tags)

TagUse when`smartexam-sso-config`You need to customize routes, provisioner, etc.`smartexam-sso-migrations`First install — adds `smartexam_id``smartexam-sso-views`You want to edit the login scriptViews are optional. To customize the login script:

```
php artisan vendor:publish --tag=smartexam-sso-views
```

```
@include('vendor.smartexam-sso.login-script')
```

---

Environment variables
---------------------

[](#environment-variables)

VariableRequiredDescription`SMARTEXAM_URL`YesSmartExam server URL (must match token `iss`)`SSO_CLIENT_KEY`YesClient key from SmartExam Admin`SSO_CLIENT_SECRET`YesSecret used to verify token signatures`SSO_CALLBACK_URL`YesYour callback URL (must match SmartExam registration)`SSO_AFTER_LOGIN_REDIRECT`NoWhere to go after login. Default: `/``SSO_AUDIENCE`NoToken `aud` claim. Default: origin of `SSO_CALLBACK_URL``SMARTEXAM_SSO_ROUTES`NoEnable package routes. Default: `true``SMARTEXAM_SSO_ROUTE_PREFIX`NoPrefix for SSO routes. Default: empty`SMARTEXAM_SSO_REQUIRE_STATE`NoRequire session state. Default: `true`---

Routes
------

[](#routes)

Registered automatically (customize in `config/smartexam-sso.php`):

MethodPathNameGET`/sso/callback``smartexam-sso.callback`POST`/api/sso/exchange``smartexam-sso.exchange`---

Customization
-------------

[](#customization)

### Custom user provisioning

[](#custom-user-provisioning)

Default behavior: find or create user by email, set `smartexam_id` from token `sub`.

For custom logic, implement `SmartExam\SsoClient\Contracts\SsoUserProvisioner`:

```
// config/smartexam-sso.php
'user_provisioner' => App\Services\YourSsoUserProvisioner::class,
```

### Post-login hook

[](#post-login-hook)

```
use SmartExam\SsoClient\Events\SmartExamSsoAuthenticated;

Event::listen(SmartExamSsoAuthenticated::class, function ($event) {
    // $event->user, $event->payload
});
```

### URL helpers

[](#url-helpers)

```
use SmartExam\SsoClient\Support\SsoUrl;

SsoUrl::overlayScript();  // SmartExam /js/sso-overlay.js URL
SsoUrl::connect($state);  // Full-page SSO connect URL
SsoUrl::issuerSignIn();   // SmartExam sign-in page
```

---

Troubleshooting
---------------

[](#troubleshooting)

ErrorFixUnexpected token audienceSet `SSO_AUDIENCE` to match your app URLUnexpected token issuer`SMARTEXAM_URL` must match token issuerInvalid / missing SSO stateUse `@include('smartexam-sso::login-script')` or reload login pageCSRF token missingAdd `` to layoutSSO client secret is not configuredSet `SSO_CLIENT_SECRET`, run `php artisan config:clear`---

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance92

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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 ~1 days

Total

7

Last Release

39d ago

PHP version history (2 changes)v1.0.0PHP ^8.2

v1.0.5PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20100302?v=4)[rajkumarchanda](/maintainers/rajkumarchanda)[@rajkumarchanda](https://github.com/rajkumarchanda)

---

Tags

laravelAuthenticationSSOsmartexam

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ums-lspl-sso-client/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77922.3M186](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k30.2M151](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M136](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M133](/packages/roots-acorn)

PHPackages © 2026

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