PHPackages                             wika-group/azureadb2c-spa-for-laravel - 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. wika-group/azureadb2c-spa-for-laravel

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

wika-group/azureadb2c-spa-for-laravel
=====================================

Use Azure AD B2C single sign-on for Laravel single-page applications

2.0.0(2mo ago)1574↓75%1MITPHPPHP ^8.2

Since Oct 28Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/WIKA-Group/azureadb2c-spa-for-laravel)[ Packagist](https://packagist.org/packages/wika-group/azureadb2c-spa-for-laravel)[ RSS](/packages/wika-group-azureadb2c-spa-for-laravel/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (1)

Azure AD B2C single sign-on for Laravel single-page applications
================================================================

[](#azure-ad-b2c-single-sign-on-for-laravel-single-page-applications)

This composer package provides the necessary logic to handle Azure B2C logins with MSAL in the front end (with a pop-up) and back-end validation. It requires Livewire.

> If you want to use it with Wire Extender, use this package [azureadb2c-spa-for-laravel-wire-extender](https://github.com/WIKA-Group/azureadb2c-spa-for-laravel-wire-extender).

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

[](#installation)

**Install the package:**

```
composer require wika-group/azureadb2c-spa-for-laravel
```

**Publish assets:**

```
php artisan vendor:publish --tag=azureb2cspa-assets
```

**Publish migration:**

```
php artisan vendor:publish --tag=azureb2cspa-migrations
```

**Extend .env and configure:**

```
AADB2C_TENANT_ID=
AADB2C_CLIENT_ID=
AADB2C_DOMAIN=            # {your_domain}.b2clogin.com
AADB2C_CUSTOM_DOMAIN=     # Optional: set to use custom domain e.g. login.contoso.com
AADB2C_POLICY=            # Optional - Default: 'B2C_1_sign-up_and_sign-in_policy'
AADB2C_DEFAULT_ALGORITHM= # Optional: Decoding algorithm JWK key. Default: 'RS256'
AADB2C_OAUTH_COLUMN=      # Optional: Name of the OAuth ID column. Default 'oauth_id'
```

**Optional: Publish config:**

```
php artisan vendor:publish --tag=azureb2cspa-config
```

Usage
-----

[](#usage)

### Add scripts to your views

[](#add-scripts-to-your-views)

```

```

In order to trigger a Livewire re-render, an event listener is required.
Therefore, the provided trait can be used inside the main Livewire component.

```
use \WikaGroup\AzureAdB2cSpa\Traits\LoginLogoutEvents;
```

### Add a button to trigger login or logout

[](#add-a-button-to-trigger-login-or-logout)

```
@auth
    Logout
@endauth
@guest
    Login with Azure B2C
@endguest
```

### Hook into the events

[](#hook-into-the-events)

You can add custom logic by using the emitted events for login and logout:

```
#[On('azureb2c-login-succeeded')]
public function azureB2cLoginSucceeded() {
    $userData = session('azureb2c-user-data');
}

#[On('azureb2c-login-failed')]
public function azureB2cLoginFailed(string $msg) {}

#[On('azureb2c-logout-succeeded')]
public function azureB2cLogoutSucceeded() {}

#[On('azureb2c-logout-failed')]
public function azureB2cLogoutFailed(string $msg) {}
```

### Configure Azure B2C

[](#configure-azure-b2c)

You must add the URL of the SPA in the Azure Portal:

[![](https://github.com/WIKA-Group/azureadb2c-spa-for-laravel/raw/main/img/AzurePortalAppRegistration.jpg)](https://github.com/WIKA-Group/azureadb2c-spa-for-laravel/blob/main/img/AzurePortalAppRegistration.jpg)

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance83

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity52

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

Every ~40 days

Total

5

Last Release

87d ago

Major Versions

1.0.3 → 2.0.02026-04-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/f7955eb510adaa883809d0df0ac4fa7e582f18fe9f6ea79463fc57a8b368bda0?d=identicon)[WIKA-Group](/maintainers/WIKA-Group)

![](https://www.gravatar.com/avatar/cb8b8450a7a9abe3de10bc9420023bc1b7deac8c3487821b01ba54be07de85c9?d=identicon)[MasterZydra](/maintainers/MasterZydra)

---

Top Contributors

[![MasterZydra](https://avatars.githubusercontent.com/u/44842054?v=4)](https://github.com/MasterZydra "MasterZydra (14 commits)")

---

Tags

azureazureb2claravellaravel-packagessosso-login

### Embed Badge

![Health badge](/badges/wika-group-azureadb2c-spa-for-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/wika-group-azureadb2c-spa-for-laravel/health.svg)](https://phpackages.com/packages/wika-group-azureadb2c-spa-for-laravel)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

123256.9k1](/packages/ellaisys-aws-cognito)[stephenjude/filament-two-factor-authentication

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

84215.9k9](/packages/stephenjude-filament-two-factor-authentication)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[marcelweidum/filament-passkeys

Use passkeys in your filamentphp app

6649.5k1](/packages/marcelweidum-filament-passkeys)

PHPackages © 2026

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