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

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

girift/apitwist-sso-laravel-client
==================================

This is the client Integration with ApiTwist SSO.

0.2.2(10mo ago)0785[3 PRs](https://github.com/GiriftEdTech/apitwist-sso-laravel-client/pulls)MITPHPPHP ^8.0CI passing

Since Sep 13Pushed 4mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (7)Versions (39)Used By (0)

This is the client Integration with ApiTwist SSO.
=================================================

[](#this-is-the-client-integration-with-apitwist-sso)

[![Latest Version on Packagist](https://camo.githubusercontent.com/edc07f92d6b8636f663b04be8f9b403427d7b79a16eb3a93c446ee130628356f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4769726966742f61706974776973742d73736f2d6c61726176656c2d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Girift/apitwist-sso-laravel-client)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/d42f3ef72a7148f284e976d86ce37c51d8f010fad16b1459c60bcc55f0cd8620/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f4769726966742f61706974776973742d73736f2d6c61726176656c2d636c69656e742f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/Girift/apitwist-sso-laravel-client/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a631cddd27d852b79f190bc644c00575ec145e3ce265d8f11eb2ec5b4d632733/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f4769726966742f61706974776973742d73736f2d6c61726176656c2d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Girift/apitwist-sso-laravel-client)

Client integration for ApiTwist SSO.

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

[](#installation)

Install the package via composer:

```
composer require girift/apitwist-sso-laravel-client
```

Add SSO config to your `.env` file:

```
SSO_CLIENT_ID=client_id
SSO_CLIENT_SECRET=client_secret
SSO_DOMAIN='https://sso.apitwist.com'
```

Add HasSsoTokens trait to your User model

```
// ...
use Girift\SSO\Traits\HasSsoTokens;

class User extends Authenticatable
{
    use HasSsoTokens;
    // ...
}
```

Add middlewares to your `app/Http/Kernel.php` file $routeMiddleware array:

```
protected $routeMiddleware = [
    // ...
    'sso.auth' => \Girift\SSO\Http\Middleware\SsoAuthenticate::class,
    'sso.api' => \Girift\SSO\Http\Middleware\SsoApiAuthenticate::class,
];
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="sso-migrations"
php artisan migrate
```

You can publish the config file with:

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

This is the contents of the published config file:

```
return [
    'client_id' => env('SSO_CLIENT_ID'),
    'client_secret' => env('SSO_CLIENT_SECRET'),
    'redirect_url' => config('app.url') . '/sso/callback',
    'sso_domain' => env('SSO_DOMAIN', 'https://sso.apitwist.com'),
    'authorize_url' => config('sso.sso_domain').'/oauth/authorize',
    'api_url' => config('sso.sso_domain').'/oauth/token',
    'logout_url' => config('sso.sso_domain'). '/logout',
    'get_user_url' => config('sso.sso_domain').  '/api/user',
];
```

Usage
-----

[](#usage)

Use `sso.auth` along with `web` middleware in your `routes/web.php` file:

```
Route::middleware([ 'web', 'sso.auth' ])->get('/route', function () {
    // Your routes
});
```

If you see `Session store not set on request.` error, add theese middlewares in your `app/Http/Kernel.php` file $middleware array:

```
protected $middleware = [
    // ...
    \Illuminate\Session\Middleware\StartSession::class,
    \Illuminate\View\Middleware\ShareErrorsFromSession::class,
];
```

Use named routes as authentication routes:

```
sso.login
sso.logout
```

Add `sso.loggedIn` named route to your home page:

```
Route::middleware([ 'web', 'sso.auth' ])->get('/home', function () {
    // Your home page
})->name('sso.loggedIn')->name('home');
```

Credits
-------

[](#credits)

- [Yasin BARAN](https://github.com/brnysn)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance67

Regular maintenance activity

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.6% 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 ~20 days

Recently: every ~105 days

Total

34

Last Release

321d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6821b3a10982ea1aa39263affe57fd0fa398481e35f31e8a43ef4c77e5c5e41f?d=identicon)[girift](/maintainers/girift)

---

Top Contributors

[![brnysn](https://avatars.githubusercontent.com/u/31011885?v=4)](https://github.com/brnysn "brnysn (62 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (14 commits)")[![mesutdgn](https://avatars.githubusercontent.com/u/101476430?v=4)](https://github.com/mesutdgn "mesutdgn (14 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (9 commits)")

---

Tags

clientlaravelSSOapitwist

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[zefy/laravel-sso

Simple PHP SSO integration for Laravel

1013.0k](/packages/zefy-laravel-sso)[njoguamos/laravel-turnstile

A laravel wrapper for https://developers.cloudflare.com/turnstile/

2315.9k2](/packages/njoguamos-laravel-turnstile)

PHPackages © 2026

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