- How do I install SocialiteProviders Manager in Laravel?
- Run `composer require socialiteproviders/manager` in your project. The package integrates via Laravel’s Service Provider and requires no manual configuration beyond adding it to your `config/app.php` providers array. Follow the [README setup guide](https://github.com/SocialiteProviders/Manager) for Lumen-specific steps.
- Which Laravel versions does this package support?
- SocialiteProviders Manager supports Laravel 6 through 12. It drops support for older versions (e.g., Laravel 5.x) and requires PHP 8.1+. Always test upgrades with `phpunit` to catch breaking changes, especially when using custom providers.
- Can I use this package with Lumen for API-only authentication?
- Yes, the package explicitly supports Lumen. Enable stateless mode with `Socialite::stateless()` for API-first setups, and leverage lazy-loading to reduce memory overhead. The [Lumen-specific docs](https://github.com/SocialiteProviders/Manager#lumen) cover minimal setup.
- How do I add a custom OAuth provider not listed in SocialiteProviders?
- Create a custom provider by extending `SocialiteProviders\Manager\Socials\Social` and register it via the `SocialiteProviders\Manager\SocialiteProvidersManagerServiceProvider`. Use the `socialite:providers` Artisan command to validate your provider before deployment.
- What’s the best way to override an existing provider (e.g., GitHub) with custom scopes?
- Use the `override` method in your `AppServiceProvider` to replace the default provider. For example: `SocialiteProviders\Manager\SocialiteProvidersManager::override('github', YourCustomGitHubProvider::class)`. Then modify the provider’s `scopes` property in your custom class.
- Does this package work with stateless authentication (e.g., JWT APIs)?
- Yes, enable stateless mode globally with `SocialiteProviders\Manager\SocialiteProvidersManager::stateless(true)` or per request with `Socialite::stateless()`. This decouples OAuth from sessions, making it ideal for APIs using Laravel Sanctum or Passport.
- How do I dynamically override provider configs at runtime (e.g., per tenant)?
- Use `Socialite::with('provider')->setConfig(['client_id' => $tenantConfig['client_id']])` before calling `redirect()`. This allows runtime swapping of credentials without modifying `.env` or provider classes.
- Are there performance concerns with lazy-loading providers?
- Lazy loading minimizes memory usage and cold-start latency, but dynamic config overrides add minor latency. Benchmark with tools like `ab` or `k6` to compare against vanilla Socialite. For high-traffic providers (e.g., GitHub), consider caching provider instances in Redis.
- How do I handle provider deprecations (e.g., Twitter API v1 shutdown)?
- Monitor provider updates via GitHub notifications or the [SocialiteProviders changelog](https://socialiteproviders.com/). Use the override mechanism to patch deprecated providers or switch to alternatives (e.g., Twitter v2) without breaking existing auth flows.
- What alternatives exist if I need more control over OAuth flows?
- For advanced use cases, consider `league/oauth2-client` (low-level) or `spatie/laravel-socialite-cookies` (for persistent auth). However, SocialiteProviders Manager offers the best balance of simplicity and extensibility for Laravel’s ecosystem, with 400+ community providers.