Microsoft

Microsoft OAuth2 login provider for Laravel Socialite

SDK
Composer
v4.10.0
35stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
41/100Fair
Development Activity40
Maintenance24
Community28
Maturity60
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
75/100Good
Architecture76
Code Quality78
Innovation68
Learning Curve82

socialiteproviders/microsoft adds Microsoft (Azure AD / Microsoft Entra ID) as an OAuth2 login provider for Laravel Socialite. It plugs into the SocialiteProviders manager so you can offer ‘Sign in with Microsoft’ in a Laravel application with the same fluent Socialite API used for the built-in providers.

The provider handles the full OAuth2 authorization-code flow against Microsoft’s identity platform, validates ID tokens, and maps the returned Microsoft Graph profile into a normalized Socialite user, including support for both work/school (Entra ID) and personal Microsoft accounts.

What You Get

  • A ‘microsoft’ driver for Laravel Socialite’s fluent OAuth flow
  • Full OAuth2 authorization-code handling against Microsoft Entra ID / Azure AD
  • ID token validation via Microsoft’s OpenID configuration and JWKS keys
  • A normalized Socialite user mapped from the Microsoft Graph profile, including tenant fields

Common Use Cases

  • Adding ‘Sign in with Microsoft’ to a Laravel application
  • Authenticating enterprise users against Microsoft Entra ID / Azure AD
  • Pulling basic Microsoft Graph profile data during social login

Under The Hood

Architecture - The package is a thin, focused set of classes. Provider extends SocialiteProviders\Manager\OAuth2\AbstractProvider and implements Microsoft-specific endpoints: it lazily loads Microsoft’s OpenID configuration and JWKS (each cached for a short TTL), validates the returned ID token with Firebase JWT, and calls Microsoft Graph to fetch user and tenant fields. MicrosoftExtendSocialite wires the driver into Socialite on the SocialiteWasCalled event, MicrosoftUser normalizes the profile, and MicrosoftAvatar resolves the user’s avatar.

Tech Stack - PHP 8.0+ depending on socialiteproviders/manager (which brings in Laravel Socialite and Guzzle) and firebase/php-jwt for token verification. Distributed via Composer with PSR-4 autoloading; it is a read-only subtree split of the monorepo SocialiteProviders/Providers.

Code Quality - The code is small (a handful of PHP files, ~20KB) and single-purpose, with typed properties, named constants for tenant ids and cache TTLs, and clear separation between token validation and Graph calls. Tests live in the upstream monorepo rather than this split, so the standalone repo carries no test suite.

API Design - Developer experience follows Socialite conventions closely: register one event listener, add a services config block, then use Socialite::driver(‘microsoft’). The main configuration surface is the Microsoft app credentials and optional field/tenant customization, and the documentation on socialiteproviders.com keeps setup to a few steps.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search