- How do I install socialiteproviders/microsoft-teamservice in a Laravel app?
- Install it with Composer by requiring socialiteproviders/microsoft-teamservice at the version your application allows. Because this repository is a read-only subtree split of the SocialiteProviders/Microsoft-TeamService provider, the code is identical to what ships in the SocialiteProviders/Providers monorepo, so you can also pull it in through that package. After installing, run composer update and verify the generated services config entry before wiring up your login route.
- How do I configure the Microsoft Teams provider in config/services.php?
- Add an entry under the services array with your Azure AD client_id, client_secret, and tenant, plus a redirect URL that exactly matches the one registered in the Azure portal. The client ID and secret come from your Azure AD app registration, and the tenant identifies the directory that issues tokens. Keep these values in .env rather than committing them, and cache the config in production with php artisan config:cache.
- What should the tenant value be for single-tenant versus multi-tenant apps?
- For a single-tenant application, use the Directory (tenant) ID GUID shown in your Azure AD app registration; for multi-tenant, the common aliases such as common or organizations let any Azure AD directory sign in. The tenant determines the authority used for the OAuth endpoints, so a mismatch produces token validation or consent errors rather than a clean login. Confirm the supported account types on the app registration match the tenant value you configure.
- How do I redirect users to Microsoft Teams and read their profile with Socialite?
- Use the standard Socialite API: return Socialite::driver('microsoft-teamservice')->redirect() from your login route, then call Socialite::driver('microsoft-teamservice')->user() in the callback. The driver name corresponds to the key you registered in config/services.php, so keep the two consistent. The returned user object exposes the usual Socialite methods such as getId, getName, getEmail, and getAvatar, plus getRaw for the full payload.
- Which Laravel and PHP versions does this package support?
- Version 4.1.0 of the SocialiteProviders line added PHP 8 support, so the 4.x series is the branch to use on modern runtimes. Laravel compatibility is declared through the illuminate/support constraint in the package's composer.json, which is the authoritative source rather than the README. Run composer why-not laravel/framework ^10.0 or composer show socialiteproviders/microsoft-teamservice to see the exact constraints your install resolved to.
- Do I need to register a service provider or add an event listener manually?
- Provider packages in the SocialiteProviders family are bootstrapped through SocialiteProviders\Manager\ServiceProvider, which listens for Socialite's build event and registers the driver. On Laravel versions with package auto-discovery that listener is picked up automatically once the package is installed. If you have disabled auto-discovery, add the manager provider to the providers array in config/app.php and re-test the redirect route.
- How is this different from laravel/socialite's built-in Microsoft or Azure provider?
- Laravel Socialite ships Microsoft Graph and Azure drivers, and this package provides a separate provider that targets Microsoft Teams authentication through Azure AD with its own tenant and scope configuration. The difference matters if you need the Teams-specific endpoint or scope behaviour, or if you are already standardising on the SocialiteProviders monorepo for other providers. If the built-in Azure driver satisfies your scopes, you may not need this package at all.
- What Azure AD permissions and scopes do I need for Microsoft Teams login?
- Your app registration needs delegated Microsoft Graph permissions sufficient to read the signed-in user, with User.Read and the OpenID scopes as the usual baseline, and admin consent granted for anything beyond that. Scopes can be requested through the Socialite with() method or set in the provider configuration, and Azure returns only the permissions already consented for the tenant. Start minimal and add Graph scopes only when you actually call those endpoints.
- How can I test the Microsoft Teams OAuth flow without hitting Azure AD?
- Mock the Socialite facade or the underlying HTTP calls so your callback test returns a fake Socialite user instead of performing a real redirect and token exchange. In feature tests, bind a stub driver via Socialite::shouldReceive('driver') and assert your controller creates the session and redirects correctly. Keep one manual smoke test against a real Azure AD app registration in staging, because mocked tests will not catch tenant, redirect URI, or consent misconfiguration.
- Is this package maintained, and is it safe to use in production?
- The 4.1.0 release adding PHP 8 support indicates the provider is being kept current with the runtime rather than abandoned, and being a subtree split means fixes land in the SocialiteProviders/Providers monorepo first. Before committing, check the release history, open issues, and the declared illuminate/support constraint for the Laravel version you run, since PHP 8 support alone does not prove Laravel 10 or 11 compatibility. Because OAuth is on the critical login path, pin the version, test the callback in staging, and keep the redirect URI and tenant settings under config management.