wika-group/azureadb2c-spa-for-laravel-wire-extender
Azure AD B2C SPA for Laravel Wire Extender integrates Azure AD B2C single-page app authentication into Laravel Wire Extender, providing configuration and wiring to add secure B2C sign-in and token-based authorization with less custom glue code.
wika-group/azureadb2c-spa-for-laravel, not a standalone auth package. It exists to make Azure AD B2C bearer-token auth work on Livewire's (wire) request lifecycle. If you have not already read the base package's README and published its config, start there — the extender assumes that setup is in place.composer require wika-group/azureadb2c-spa-for-laravel-wire-extender
Pair it with a compatible version of the base azureadb2c-spa-for-laravel package; v2.0.0 of the extender may require a newer base version than v1.0.1 did. Check composer.json constraints rather than assuming.vendor:publish --tag=...; confirm the exact tag in the README), then set the standard B2C env vars the base package expects — tenant/subdomain, client ID, policy/user-flow name, and the audience your API exposes./livewire/update POST. The minimal win is: authenticate in the SPA, attach the bearer token to Livewire requests, and have auth()->user() resolve inside a component without a Laravel session.Livewire.hook('request', ({ options }) => {
options.headers = { ...options.headers, Authorization: `Bearer ${token}` };
});
Treat this as the critical integration point — most "it works on page load but not on update" bugs live here.auth()->check().oid, sub, emails, name) into your App\Models\User. Keep this in one place — a single resolveUserFromClaims() service — and reuse it in tests and in any queued/console context.refresh_interval on the Livewire side or an explicit re-auth flow when a 401 comes back from the update endpoint.^1.0 if you cannot budget the migration./livewire/update (and uploads to /livewire/upload-file). Any auth that only covers the first will appear to work until the user clicks something.@auth in Blade, redirects, and wire:navigate continuity. Decide early whether you are maintaining a session after token validation or staying fully stateless; mixing the two is the most common source of "user flickers to logged-out" reports.iss values. If you validate issuer against a single hard-coded policy, sign-up tokens will be rejected. Validate against the set of configured policies.aud (your API's exposed scope, not the SPA client ID), iss, exp/nbf with a small clock-skew allowance, and scp/roles if you gate on them.401 with no reason is nearly impossible to diagnose against B2C.How can I help you explore Laravel packages today?