PHPackages                             alexandergabriel/filament-oauth2 - 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. alexandergabriel/filament-oauth2

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

alexandergabriel/filament-oauth2
================================

Enable OAuth2 Authentication to FilamentPHP Panels

v1.0.2(2mo ago)09[2 PRs](https://github.com/AlexanderGabriel/filament-oauth2/pulls)MITPHPPHP ^8.2CI passing

Since Nov 11Pushed 1mo agoCompare

[ Source](https://github.com/AlexanderGabriel/filament-oauth2)[ Packagist](https://packagist.org/packages/alexandergabriel/filament-oauth2)[ Docs](https://github.com/alexandergabriel/filament-oauth2)[ GitHub Sponsors](https://github.com/AlexanderGabriel)[ RSS](/packages/alexandergabriel-filament-oauth2/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (26)Versions (10)Used By (0)

This is my package filament-oauth2
==================================

[](#this-is-my-package-filament-oauth2)

[![Latest Version on Packagist](https://camo.githubusercontent.com/53e686613bd7ecc12ec12e112a4765bb9cba4f8a29a9e345b0ad7723017cb59d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c6578616e6465726761627269656c2f66696c616d656e742d6f61757468322e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alexandergabriel/filament-oauth2)[![GitHub Tests Action Status](https://camo.githubusercontent.com/744909821e51983a74ed2f433fc178ba6aabd2d4fed8ec44b3d801679d0bd902/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616c6578616e6465726761627269656c2f66696c616d656e742d6f61757468322f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/alexandergabriel/filament-oauth2/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/e4812e480da43d860c774c363927010fa42b0e03749f2598a402454b103d6bbd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616c6578616e6465726761627269656c2f66696c616d656e742d6f61757468322f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/alexandergabriel/filament-oauth2/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/eeb2e40ddc1b77a782d57aaa3e84096c38b85add1a1912ab6a1439408b0259f8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c6578616e6465726761627269656c2f66696c616d656e742d6f61757468322e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alexandergabriel/filament-oauth2)

> !!!
> This Plugin is still under development and only tested with Keycloak.
> This is my first FilamentPHP-Plugin.
> Feedback welcome.
> !!!

This Plugin enables OAuth2-Login for [FilamentPHP](https://filamentphp.com) Panels.
Login and logout is done by OAuth2-Server.
If the OAuth2-Server provides roles for your client, they will be mapped to the App\\Models\\Role-Model
Non-existing Roles will be created. Users will be detached to roles not in the access token any more.

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

[](#installation)

You can install the package via composer:

```
composer require alexandergabriel/filament-oauth2
```

You can publish the config file with:

```
php artisan vendor:publish --tag="filament-oauth2-config"
```

This is the contents of the published config file:

```
return [
    'clientId' => env("OAUTH2_CLIENT_ID"),
    'clientSecret' => env("OAUTH2_CLIENT_SECRET"),
    'baseUrl' => env("OAUTH2_BASE_URL"), // https://DOMAIN/realms/REALM/protocol/openid-connect
    'urlAuthorize' => env("OAUTH2_URL_AUTHORIZE", env("OAUTH2_BASE_URL")."/auth"),
    'urlAccessToken' => env("OAUTH2_URL_ACCESS_TOKEN", env("OAUTH2_BASE_URL")."/token"),
    'urlResourceOwnerDetails' => env("OAUTH2_URL_RESOURCE_OWNER_DETAILS", env("OAUTH2_BASE_URL")."/userinfo"),
    'urlLogout' => env("OAUTH2_URL_LOGOUT", env("OAUTH2_BASE_URL")."/logout"),
    'urlAfterlogout' => env("OAUTH2_URL_AFTER_LOGOUT", url('/')),
    'scopes' => env("OAUTH2_SCOPES", "profile email openid"),
    'updateRoles' => env("OAUTH2_UPDATE_ROLES", false)
];
```

Usage
-----

[](#usage)

Load Plugin in your PanelProvider under filament-oauth2-demo/app/Providers/Filament:

```
class YOURPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->plugin(
                new FilamentOauth2Plugin()
            )
```

### To configure, add some config to your .env:

[](#to-configure-add-some-config-to-your-env)

- OAUTH2\_CLIENT\_ID\*
    - OAuth2 client id, mandatory
- OAUTH2\_CLIENT\_SECRET\*
    - OAuth2 client secret, mandatory
- OAUTH2\_BASE\_URL\*
    - Base url to OAuth2 authentication server
    - must include realm:
- OAUTH2\_URL\_AUTHORIZE
    - authorization url
    - defaults to OAUTH2\_BASE\_URL+/auth
- OAUTH2\_URL\_ACCESS\_TOKEN
    - token url
    - defaults to OAUTH2\_BASE\_URL+/token
- OAUTH2\_URL\_RESOURCE\_OWNER\_DETAILS
    - resource owner details url
    - defaults to OAUTH2\_BASE\_URL+/userinfo
    - todo: needed?
- OAUTH2\_URL\_LOGOUT
    - logout url
    - defaults to OAUTH2\_BASE\_URL+/logout
- OAUTH2\_URL\_AFTER\_LOGOUT
    - post\_logout\_redirect\_uri
    - defaults to base url of Laravel app (without panel)
- OAUTH2\_SCOPES
    - scopes
    - defaults to "profile email openid"
- OAUTH2\_UPDATE\_ROLES
    - look for roles in token and update/create and map them
    - defaults to false

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- To all helping developing and keeping alive FilamentPHP, PHP, OAuth2 and the OpenSource Ecosystem!
- [Alexander Gabriel](https://github.com/AlexanderGabriel)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance89

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.1% 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 ~19 days

Recently: every ~28 days

Total

7

Last Release

65d ago

Major Versions

v0.9.3 → v1.0.02025-11-16

PHP version history (2 changes)v0.9.0PHP ^8.1

v0.9.2PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/6bcd4916301c1cac9d1186b57b3f994721f7c2116a0c13148333bc0506332a18?d=identicon)[AlexanderGabriel](/maintainers/AlexanderGabriel)

---

Top Contributors

[![AlexanderGabriel](https://avatars.githubusercontent.com/u/23343388?v=4)](https://github.com/AlexanderGabriel "AlexanderGabriel (41 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelfilamentAlexanderGabrielfilament-oauth2

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/alexandergabriel-filament-oauth2/health.svg)

```
[![Health](https://phpackages.com/badges/alexandergabriel-filament-oauth2/health.svg)](https://phpackages.com/packages/alexandergabriel-filament-oauth2)
```

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[stephenjude/filament-two-factor-authentication

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

81158.7k4](/packages/stephenjude-filament-two-factor-authentication)[marcelweidum/filament-passkeys

Use passkeys in your filamentphp app

5925.8k](/packages/marcelweidum-filament-passkeys)[chiiya/filament-access-control

Admin user, role and permission management for Laravel Filament

21847.2k](/packages/chiiya-filament-access-control)[diogogpinto/filament-auth-ui-enhancer

This Filament plugin empowers you to transform your auth pages with ease, allowing you to make them truly stand out. It offers a flexible alternative to the default auth pages in the Filament Panels package.

13493.9k6](/packages/diogogpinto-filament-auth-ui-enhancer)[yebor974/filament-renew-password

Package for manage renew password according to the last renew or other criteria

4482.6k3](/packages/yebor974-filament-renew-password)

PHPackages © 2026

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