Menu

Laravel Socialite Login with Microsoft Account (Laravel 13)
📰

Laravel Socialite Login with Microsoft Account (Laravel 13)

DEV Community: authentication·Muhammad Yasir Amin·5 days ago
#MAoJljAN
Reading 0:00
15s threshold

To add "Sign in with Microsoft" to a Laravel 13 app, install laravel/socialite plus the community socialiteproviders/microsoft driver, register the driver in a service provider, add your Entra ID (Azure) app credentials to config/services.php , and create a redirect route and a callback route. The callback finds or creates a local user and logs them in. Below is the flow step by step.

Microsoft is not one of the built-in Socialite drivers. The official docs list Facebook, X, LinkedIn, Google, GitHub, GitLab, Bitbucket and Slack, and point to the community Socialite Providers project for everything else. That is why one extra package is needed.

How does the Microsoft login flow work?

Your app sends the browser to Microsoft with your client ID and redirect URI. The user signs in and approves. Microsoft redirects back to your callback route with a code. Socialite exchanges that code for the user profile, and your controller maps the profile to a row in the users table.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.