PHPackages                             abublihi/laravel-external-jwt-guard - 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. abublihi/laravel-external-jwt-guard

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

abublihi/laravel-external-jwt-guard
===================================

It's a laravel custom auth guard for authenticating users using External JWT

v3.0.2(4mo ago)133.5k↑100%1[1 issues](https://github.com/abublihi/laravel-external-jwt-guard/issues)MITPHPPHP ^8.0CI passing

Since Jan 16Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/abublihi/laravel-external-jwt-guard)[ Packagist](https://packagist.org/packages/abublihi/laravel-external-jwt-guard)[ Docs](https://github.com/abublihi/laravel-external-jwt-guard)[ RSS](/packages/abublihi-laravel-external-jwt-guard/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (18)Used By (0)

Laravel External JWT Guard
==========================

[](#laravel-external-jwt-guard)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bd54459ffb0ed7ef6907f3e636af413e3a4abcaacf5f95804755681fc2020944/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616275626c6968692f6c61726176656c2d65787465726e616c2d6a77742d67756172642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abublihi/laravel-external-jwt-guard)[![Total Downloads](https://camo.githubusercontent.com/8eb7f88fcede30d55f1bafe19226b07276133e121a114e55e3a9ae732035f247/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616275626c6968692f6c61726176656c2d65787465726e616c2d6a77742d67756172642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abublihi/laravel-external-jwt-guard)[![Tests](https://github.com/abublihi/laravel-external-jwt-guard/actions/workflows/run-tests.yml/badge.svg)](https://github.com/abublihi/laravel-external-jwt-guard/actions/workflows/run-tests.yml/badge.svg)

This package provides a simple custom authentication guard for Laravel using an external JWT provided by an OAuth server or Any type of SSO that uses a JWT. Below a figure describe the flow.

[![](https://private-user-images.githubusercontent.com/10172039/296034439-20ca24cf-7684-4fc6-a9ce-515823a5a7da.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzIyNDExMjYsIm5iZiI6MTc3MjI0MDgyNiwicGF0aCI6Ii8xMDE3MjAzOS8yOTYwMzQ0MzktMjBjYTI0Y2YtNzY4NC00ZmM2LWE5Y2UtNTE1ODIzYTVhN2RhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjI4VDAxMDcwNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBjZjUyYzQzNjVkNjJmMjMxMmYxYmY0MDI0YTU4MzgwMGViMjhiMTM5OTEwZGZhYWIyYTc4YjdlNmUwYjc2NDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.MGUa6JKWitWW5Ry1KtflH1NMzolCWOVVwZqmvzPa5Dk)](https://private-user-images.githubusercontent.com/10172039/296034439-20ca24cf-7684-4fc6-a9ce-515823a5a7da.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzIyNDExMjYsIm5iZiI6MTc3MjI0MDgyNiwicGF0aCI6Ii8xMDE3MjAzOS8yOTYwMzQ0MzktMjBjYTI0Y2YtNzY4NC00ZmM2LWE5Y2UtNTE1ODIzYTVhN2RhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjI4VDAxMDcwNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBjZjUyYzQzNjVkNjJmMjMxMmYxYmY0MDI0YTU4MzgwMGViMjhiMTM5OTEwZGZhYWIyYTc4YjdlNmUwYjc2NDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.MGUa6JKWitWW5Ry1KtflH1NMzolCWOVVwZqmvzPa5Dk)

Stand Alone
-----------

[](#stand-alone)

If you prefer not to install the package, I highly recommend using the standalone code by following the guide here [stand alone](stand-alone.md)

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

[](#installation)

You can install the package via composer:

```
composer require abublihi/laravel-external-jwt-guard
```

publish the configuration file `externaljwtguard.php`

```
php artisan vendor:publish --provider="Abublihi\LaravelExternalJwtGuard\LaravelExternalJwtGuardServiceProvider" --tag config
```

Usage
-----

[](#usage)

The package is very simple but also powerful when it comes to customization, After installation and publishing of the configurations you should first configure your `default` authorization server,

> NOTE: The package allow you to add multiple authorization servers but for mostly use cases you only need one authorization server.

### Configure your Authorization server

[](#configure-your-authorization-server)

```
