Microsoft
Microsoft OAuth2 login provider for Laravel Socialite
Repository Health
Technical Analysis
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.
Used by 2 apps in this directory
Invoice Ninja
Invoicing Finance · Project Management
Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.
Leantime
Productivity · Project Management · Collaboration
Project management built for ADHD, autism, and dyslexia — simple as Trello, powerful as Jira