socialiteproviders/microsoft-azure
Laravel Socialite provider for Microsoft Azure (Entra ID) OAuth login. Configure client ID, secret and tenant to sign users in, retrieve their id, name and email, support multiple tenants, and generate Azure logout URLs.
Architecture fit
Provider class extending Socialite's AbstractProvider, registered through socialiteproviders/manager's SocialiteWasCalled event. It adds no database tables, no migrations, no queues, and no persistent state — sessions and state/PKCE handling remain Socialite's responsibility. That means it drops cleanly into an existing Laravel auth flow and is equally clean to remove.laravel/socialite plus the manager package) plus a community provider ecosystem convention we would then be expected to follow for every future IdP.tenant config key is the meaningful architectural decision point: single-tenant (employee SSO), organizations, common, or consumers materially change the security posture and the account-linking logic downstream.graph_url override is the right shape for sovereign clouds (GCC High, China) and for test doubles, but it is also a token-exfiltration surface — the access token is sent to whatever URL is configured. This must be an infrastructure-owned config value, never developer-editable at runtime.Integration feasibility
composer require, a config/services.php block, one Event::listen closure in AppServiceProvider::boot() (Laravel 11+) or an entry in EventServiceProvider::$listen (Laravel ≤10), two routes (redirect + callback), and a user-mapping action.azure driver in core. Before adopting a 60-star community wrapper, confirm which capabilities we actually need beyond core (proxy support, graph_url override, manager-based extensibility). If core suffices, the correct decision is zero new dependencies and one less thing to maintain. This is the highest-leverage review action on this package.Technical risk
/me claim shapes, deprecated mail vs userPrincipalName behaviour, personal-account claim gaps). The provider is a pass-through; the mapping code we write on top is where breakage will land.sub is pairwise per app and unsuitable as a stable key; oid + tid is the durable identifier. Email is not guaranteed for guest or personal accounts. Getting this wrong produces duplicate accounts that are expensive to reconcile later.Key questions
azure driver already satisfy the requirement, making this package unnecessary?oid/tid, UPN, mail, display name, group membership, app roles, photo? Anything beyond /me basic profile implies additional Graph calls and scopes this package will not make for us.AZURE_CLIENT_SECRET rotation, and what is the maximum secret lifetime we will accept?graph_url locked down by config governance?Stack fit
laravel/socialite constraint during composer require.Migration path
users linkage column (azure_oid + azure_tid, unique composite) and a nullable password if we are introducing SSO into a password-based app./me parsing. Keep the existing user-mapping logic, replace only the transport. Run both paths behind a flag with the legacy path as fallback for one release cycle.azure: if we migrate, it should be for a documented capability gap (proxy, graph_url, manager conventions), not for preference. Document the gap or stay on core.Compatibility
EventServiceProvider, so listener registration must go in AppServiceProvider::boot(). This is the single most common install failure and should be a line in the runbook, not tribal knowledge.graph_url explicitly and must not inherit the default.Sequencing
oid/tid/email for a member account, a guest account, and a personal account. Record which fields are absent. This is the input to the user-mapping design.oid+tid, decide JIT-provision vs pre-provision, decide what happens when a user is deprovisioned in Entra but still exists locally.Maintenance
laravel/socialite major versions and the manager package move independently of this provider).app/" is a credible 1-day fallback and should be written down before it is needed — it converts the abandonment risk from a blocker into an inconvenience.Support
Scaling
/me call per login. No storage, no background work, scales linearly with login volume only.Failure modes
AADSTS65001. Caught only by real login attempts; synthetic login monitoring is worth the investment.common shipped to production where single-tenant was intended) — the dangerous one, because it works while silently admitting accounts it should not. Enforce via config validation at boot, not code review.graph_url misconfiguration — access tokens sent to an unintended host. Treat as a security incident class; restrict the value to an allowlist in config and assert it in a test.Ramp-up
How can I help you explore Laravel packages today?