PHPackages                             edrisaturay/filament-azure-socialite - 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. edrisaturay/filament-azure-socialite

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

edrisaturay/filament-azure-socialite
====================================

Azure AD (Microsoft) Socialite authentication plugin for Filament v3 and v4

v1.0.0(6mo ago)15MITPHPPHP ^8.1CI failing

Since Dec 29Pushed 6mo agoCompare

[ Source](https://github.com/edrisaturay/filament-azure-socialite-provider)[ Packagist](https://packagist.org/packages/edrisaturay/filament-azure-socialite)[ RSS](/packages/edrisaturay-filament-azure-socialite/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (10)Versions (2)Used By (0)

Filament Azure Socialite
========================

[](#filament-azure-socialite)

[![Latest Version](https://camo.githubusercontent.com/5553120aa5a7ac76dba774876128a4c64b9d861760344c1a6378f2be77ef6d09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65647269736174757261792f66696c616d656e742d617a7572652d736f6369616c6974652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/edrisaturay/filament-azure-socialite)[![Total Downloads](https://camo.githubusercontent.com/ee22dbeb889ff37d99146bc4ebcaa1578eb6df3013de2404570bb69d4724b369/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f65647269736174757261792f66696c616d656e742d617a7572652d736f6369616c6974652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/edrisaturay/filament-azure-socialite)

A production-ready Filament plugin that adds "Login with Microsoft" (Azure AD) authentication to your Filament panels using Laravel Socialite and SocialiteProviders.

Features
--------

[](#features)

- ✅ **Multi-Panel Support** - Works with multiple Filament panels
- ✅ **Auto-Registration** - Automatically registers the Socialite provider
- ✅ **Auto Redirect URI** - Computes redirect URIs dynamically (no manual configuration needed)
- ✅ **Security Features** - Email domain and tenant ID restrictions
- ✅ **Flexible Configuration** - Fluent API for easy setup
- ✅ **Enterprise Ready** - Production-quality error handling and logging
- ✅ **Filament v3 &amp; v4** - Compatible with both versions
- ✅ **Laravel 10-12** - Supports all recent Laravel versions

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Laravel &gt;= 10.0
- Filament &gt;= 3.0

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

[](#installation)

Install the package via Composer:

```
composer require edrisaturay/filament-azure-socialite
```

Configuration
-------------

[](#configuration)

### 1. Azure App Registration

[](#1-azure-app-registration)

First, you need to register your application in Azure AD:

1. Go to [Azure Portal](https://portal.azure.com)
2. Navigate to **Azure Active Directory** &gt; **App registrations**
3. Click **New registration**
4. Enter a name for your app
5. Select supported account types:
    - **Single tenant**: Your organization only
    - **Multi-tenant**: Any organization
    - **Multi-tenant + personal**: Any organization + personal accounts
6. Set **Redirect URI**:
    - Platform: **Web**
    - URI: `{your-app-url}/{panel-path}/auth/azure/callback`
    - Example: `https://example.com/admin/auth/azure/callback`
7. Click **Register**
8. Copy the **Application (client) ID** to your `.env` file
9. Go to **Certificates &amp; secrets** &gt; **New client secret**
10. Copy the secret value to your `.env` file
11. Note your **Directory (tenant) ID** for the `.env` file

### 2. Environment Variables

[](#2-environment-variables)

Add these to your `.env` file:

```
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret
AZURE_TENANT_ID=common
```

**Note**: The `AZURE_REDIRECT_URI` is optional - it will be auto-computed per panel if not set.

### 3. Services Configuration

[](#3-services-configuration)

Add this to your `config/services.php`:

```
'azure' => [
    'client_id' => env('AZURE_CLIENT_ID'),
    'client_secret' => env('AZURE_CLIENT_SECRET'),
    'redirect' => env('AZURE_REDIRECT_URI'), // Optional
    'tenant' => env('AZURE_TENANT_ID', 'common'),
    'proxy' => env('PROXY'), // Optional
],
```

### 4. Multi-Tenant Configuration

[](#4-multi-tenant-configuration)

For `AZURE_TENANT_ID`, use:

- **Single tenant**: Your tenant ID (e.g., `12345678-1234-1234-1234-123456789012`)
- **Multi-tenant (organizations only)**: `organizations`
- **Multi-tenant + personal**: `common` (default)
- **Personal accounts only**: `consumers`

### 5. Register the Plugin

[](#5-register-the-plugin)

#### Filament v4

[](#filament-v4)

In your panel provider (e.g., `app/Providers/Filament/AdminPanelProvider.php`):

```
use EdrisaTuray\FilamentAzureSocialite\FilamentAzureSocialitePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentAzureSocialitePlugin::make()
                ->enabled()
                ->buttonLabel('Login with Microsoft')
                ->hook('after') // or 'before'
                ->allowRegistration(true)
                ->allowedDomains(['company.com']) // Optional
                ->allowedTenants(['tenant-id']) // Optional
        ]);
}
```

#### Filament v3

[](#filament-v3)

In your panel provider:

```
use EdrisaTuray\FilamentAzureSocialite\FilamentAzureSocialitePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentAzureSocialitePlugin::make()
                ->enabled()
                ->buttonLabel('Login with Microsoft')
                ->hook('after')
                ->allowRegistration(true)
        ]);
}
```

Configuration Options
---------------------

[](#configuration-options)

### Basic Configuration

[](#basic-configuration)

```
FilamentAzureSocialitePlugin::make()
    ->enabled(true)                    // Enable/disable the plugin
    ->buttonLabel('Login with Microsoft') // Button text
    ->hook('after')                    // 'before' or 'after' the login form
    ->allowRegistration(true)          // Allow creating new users
```

### Security Configuration

[](#security-configuration)

```
FilamentAzureSocialitePlugin::make()
    ->allowedDomains(['company.com', 'partner.com']) // Restrict to specific email domains
    ->allowedTenants(['tenant-id-1', 'tenant-id-2']) // Restrict to specific Azure tenants
```

### Custom User Resolution

[](#custom-user-resolution)

```
FilamentAzureSocialitePlugin::make()
    ->resolveUserUsing(function ($azureUser) {
        // Custom logic to find or create user
        return User::firstOrCreate(
            ['email' => $azureUser->getEmail()],
            [
                'name' => $azureUser->getName(),
                'role' => 'user',
            ]
        );
    })
```

### Callbacks

[](#callbacks)

```
FilamentAzureSocialitePlugin::make()
    ->beforeRedirect(function ($request, $config) {
        // Called before redirecting to Azure
        // You can modify $config here
    })
    ->afterUserResolved(function ($user, $azureUser) {
        // Called after user is resolved/created
        // Useful for syncing additional data
    })
```

Artisan Commands
----------------

[](#artisan-commands)

### Installation Guide

[](#installation-guide)

Get step-by-step installation instructions:

```
php artisan filament-azure-socialite:install
```

This command will:

- Show required environment variables
- Display computed redirect URLs for each panel
- Provide Azure App Registration steps

### Configuration Doctor

[](#configuration-doctor)

Validate your configuration:

```
php artisan filament-azure-socialite:doctor
```

This command checks:

- Services configuration
- Route registration per panel
- Socialite listener registration
- Environment configuration (APP\_URL, HTTPS, proxy)

Multi-Panel Setup
-----------------

[](#multi-panel-setup)

The plugin supports multiple Filament panels. Each panel can have its own configuration:

```
// Admin Panel
AdminPanelProvider::class => [
    FilamentAzureSocialitePlugin::make()
        ->enabled()
        ->allowedDomains(['admin.company.com'])
],

// User Panel
UserPanelProvider::class => [
    FilamentAzureSocialitePlugin::make()
        ->enabled()
        ->allowedDomains(['company.com'])
        ->allowRegistration(true)
],
```

User Model
----------

[](#user-model)

The plugin works with any user model. By default, it uses `App\Models\User`.

### Storing Azure ID

[](#storing-azure-id)

If you want to store the Azure user ID, add an `azure_id` column to your users table:

```
Schema::table('users', function (Blueprint $table) {
    $table->string('azure_id')->nullable()->unique();
});
```

The plugin will automatically store the Azure ID if the column exists.

Error Handling
--------------

[](#error-handling)

The plugin provides user-friendly error messages via Filament notifications:

- **Invalid email domain**: "Your email domain is not authorized"
- **Invalid tenant**: "Your organization is not authorized"
- **Registration disabled**: "User registration is not allowed"
- **General errors**: "An error occurred during authentication"

Errors are logged in local/dev environments for debugging.

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

[](#troubleshooting)

### Button Not Showing

[](#button-not-showing)

1. Ensure the plugin is enabled: `->enabled()`
2. Check that routes are registered: `php artisan route:list | grep azure`
3. Run the doctor command: `php artisan filament-azure-socialite:doctor`

### Redirect URI Mismatch

[](#redirect-uri-mismatch)

The redirect URI in Azure must match exactly. The plugin auto-computes the URI, but you can verify it:

```
php artisan filament-azure-socialite:install
```

Make sure the redirect URI in Azure matches the computed one.

### HTTPS Required

[](#https-required)

Azure requires HTTPS for production redirect URIs. If testing locally, you can use `http://localhost`, but production must use HTTPS.

### Proxy Configuration

[](#proxy-configuration)

If you're behind a proxy, set the `PROXY` environment variable:

```
PROXY=http://proxy.example.com:8080
```

Testing
-------

[](#testing)

The package includes tests using Pest/PHPUnit and Orchestra Testbench. Run tests with:

```
composer test
```

Security Considerations
-----------------------

[](#security-considerations)

1. **Always use HTTPS in production** - Azure requires it
2. **Restrict email domains** - Use `allowedDomains()` for enterprise apps
3. **Restrict tenants** - Use `allowedTenants()` for multi-tenant apps
4. **Disable registration** - Set `allowRegistration(false)` if you only want existing users
5. **Validate redirects** - The plugin only redirects within the panel scope

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

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

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

Support
-------

[](#support)

For issues and questions, please open an issue on [GitHub](https://github.com/edrisaturay/filament-azure-socialite).

filament-azure-socialite-provider
=================================

[](#filament-azure-socialite-provider)

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance68

Regular maintenance activity

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

188d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/95329b757401f7d19594b60cf196fef575ef365863207549dd320a28d03172e7?d=identicon)[edrisaa.turay](/maintainers/edrisaa.turay)

---

Top Contributors

[![edrisaturay](https://avatars.githubusercontent.com/u/21174548?v=4)](https://github.com/edrisaturay "edrisaturay (20 commits)")

---

Tags

laravelAuthenticationoauthsocialitemicrosoftazurefilament

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/edrisaturay-filament-azure-socialite/health.svg)

```
[![Health](https://phpackages.com/badges/edrisaturay-filament-azure-socialite/health.svg)](https://phpackages.com/packages/edrisaturay-filament-azure-socialite)
```

###  Alternatives

[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[stephenjude/filament-two-factor-authentication

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

84215.9k9](/packages/stephenjude-filament-two-factor-authentication)[chrisreedio/socialment

Provides Socialite functionality for Filament.

111103.2k2](/packages/chrisreedio-socialment)[marcelweidum/filament-passkeys

Use passkeys in your filamentphp app

6649.5k1](/packages/marcelweidum-filament-passkeys)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

35156.4k2](/packages/andrewdwallo-filament-companies)[solution-forest/filament-email-2fa

filament-email-2fa

3211.0k](/packages/solution-forest-filament-email-2fa)

PHPackages © 2026

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