socialiteproviders/microsoft
Microsoft provider for Laravel Socialite adds Microsoft (Azure AD) OAuth login to your Laravel app. Install via Composer, configure your client ID, secret, and tenant, then use Socialite::driver('microsoft') to authenticate users and retrieve profile data.
Architecture fit. This is a Socialite driver, not an identity platform. It teaches laravel/socialite the Entra ID (Azure AD) OAuth2 endpoints and maps the Microsoft Graph me payload into Socialite's standard User object. That makes it a good fit only where Socialite is already the identity seam: one more provider behind Socialite::driver('microsoft'), with token, state, and callback mechanics delegated upstream to Socialite and socialiteproviders/manager. It is a bad fit as a standalone auth layer, and it does not cover Graph data access, token lifecycle, daemon/background flows, or native/mobile auth — those need MSAL or the Graph SDK alongside it.
Integration feasibility. High for a conventional Laravel web app: Composer install, register the SocialiteWasCalled listener, add a microsoft block to config/services.php, wire redirect and callback routes, map the returned user. The package is the smallest part of the work. The bulk is tenant topology, app registration, admin consent, scope selection, redirect URI inventory, and — critically — deciding what the canonical user identifier is. A TPM should plan the effort around those identity operations, not around the adapter.
Technical risk. Low code risk, material dependency and identity risk:
socialiteproviders/providers monorepo, but they still mean this specific split artifact has little visible downstream validation. Treat it as a replaceable adapter, not a strategic dependency.laravel/socialite, socialiteproviders/manager, Laravel, and PHP must be verified at install and at every upgrade — a Socialite major can leave this split package behind.microsoft, microsoft-azure, in-house subclasses). Picking the wrong one causes churn and inconsistent claim mapping later.email claim is not universally present or stable. Using email as the primary key invites account-linking takeover. Link on Entra oid plus tenant_id.Key questions a TPM must get answered before commit:
common/organizations), consumer accounts, or CIAM/B2C?oid, sub, UPN, employee ID), and which team owns that mapping?microsoft-azure / an in-house AbstractProvider fit better?Stack fit. A Laravel application on a current PHP 8.x runtime, Socialite 5.x-era APIs, and the SocialiteProviders manager, with a normal server-side session for OAuth state. It does not fit stateless API-only backends without the team supplying its own state handling, and it does not replace MSAL for native, mobile, or daemon scenarios.
Migration path. Additive provider, not a rip-and-replace:
provider = microsoft, provider_user_id = oid, persist tenant_id. No auto-linking on unverified email.Compatibility checks.
laravel/socialite, socialiteproviders/manager, Laravel, and PHP.config:cache behavior so tenant and redirect values aren't baked incorrectly per environment.Sequencing. Entra app registration and consent model first, then a package spike, then identity mapping, then UI, then production tenant rollout. Reversing this order produces a working login that authenticates the wrong person or cannot obtain consent — the most expensive way to discover a scoping mistake.
Maintenance. Low code maintenance, moderate dependency maintenance. Pin and upgrade deliberately alongside Socialite and the manager; watch monorepo release cadence and Socialite major-version breaks. Budget a small recurring allocation for Composer updates plus a periodic login smoke test per tenant model.
Support. Community-supported, no vendor SLA; the monorepo issue tracker is the channel. Given the weak split-package adoption signal, plan for the possibility of forking the provider or substituting a small in-house AbstractProvider subclass. That fallback is genuinely cheap — the driver is thin — because the expensive work (tenant setup, consent, identity mapping) is internal and stays internal either way.
Scaling. Login volume is small relative to application traffic and the OAuth exchange is one external call per login. The package is not a scaling bottleneck. Scaling risk arrives after login: Graph throttling, refresh-token storage and encryption, per-user caching, and retry design all become application responsibilities. Socialite hands you tokens; it does not manage their lifecycle.
Failure modes to plan for.
AADSTS50011 redirect URI mismatch after a domain, environment, or deployment change.AADSTS65001 consent missing when new scopes are added without admin consent.AADSTS700016 app not provisioned in the tenant, common in single-tenant and guest scenarios.email, changed UPN, guest accounts — breaking user matching.Ramp-up. A Socialite-fluent Laravel developer integrates the package in under a day. A production-ready rollout — tenant selection, consent, identity mapping, secret rotation, rollback plan, pilot — is closer to one to two weeks of cross-team effort, with identity/security owning the Entra side. Staff an identity owner, not just a Laravel developer, and position the package in the plan as a replaceable adapter inside a larger Microsoft identity integration rather than as the integration itself.
How can I help you explore Laravel packages today?