- How do I install socialiteproviders/mailru in a Laravel app?
- Run composer require socialiteproviders/mailru. Add the SocialiteProviders\Manager\ServiceProvider to the providers array in config/app.php on Laravel versions without package auto-discovery, then add your Mail.ru credentials to config/services.php. There are no migrations, middleware, or queue workers involved. A developer familiar with Socialite should finish in under a day including a test-environment OAuth round trip.
- How do I configure Mail.ru OAuth credentials in config/services.php?
- Add a mailru block containing client_id, client_secret, and redirect, and source those values from environment variables such as MAILRU_CLIENT_ID, MAILRU_CLIENT_SECRET, and MAILRU_REDIRECT_URI. Never commit the client secret to the repository. Keep the redirect URI exactly matching the callback URL registered in the Mail.ru application settings, otherwise the token exchange will fail.
- Which Laravel, PHP, and Socialite versions does socialiteproviders/mailru support?
- The package requires PHP 8.x, laravel/socialite, and socialiteproviders/manager, but the exact declared constraints should be checked in the package composer.json before you commit. Community providers typically lag behind Socialite major releases, which have introduced breaking contract changes. If the app is on an older Laravel or Socialite major, expect to pin an earlier provider tag, and test the matrix of Laravel major, Socialite major, and PHP minor.
- Do I need to register the SocialiteProviders Manager service provider manually?
- On Laravel versions with package auto-discovery, the manager service provider is detected automatically, so you usually do not need to touch config/app.php. Older Laravel applications require you to add SocialiteProviders\Manager\ServiceProvider to the providers array manually. The manager registers an event listener that calls Socialite::extend() with the MailruProvider class, which is how Socialite::driver('mailru') becomes available.
- How do I add Mail.ru login routes and a callback in Laravel?
- Create two routes: one that calls Socialite::driver('mailru')->redirect() to send the user to Mail.ru, and a callback route that calls Socialite::driver('mailru')->user() to complete the exchange. Reuse the same OAuth controller pattern you already use for Google or GitHub rather than writing a bespoke callback. Keeping the Socialite::driver() call site uniform preserves your ability to swap or add providers later.
- How do I retrieve the Mail.ru user's profile with Socialite?
- After the callback, call Socialite::driver('mailru')->user() to get a Socialite User object populated from Mail.ru's user-info endpoint. You can then use the usual accessors such as getId, getNickname, getName, getEmail, and getAvatar. Do not assume every field is populated, since the available attributes can depend on the scopes requested. Store the returned provider ID alongside the provider name so you can match returning users.
- What scopes and OAuth endpoints does this Mail.ru provider target?
- The provider maps Mail.ru's OAuth 2.0 authorization and token endpoints plus a user-info call onto a Socialite User object. Because Mail.ru's consumer identity stack has been folded into the VK Group and VK ID ecosystem, you should confirm with the maintainers that these endpoints and scopes remain the officially recommended surface. That vendor consolidation question is the single largest long-term risk for this integration.
- Does socialiteproviders/mailru handle token refresh and OAuth errors?
- Socialite itself is request-based and does not manage refresh tokens for you, so treat refresh and failure handling as your responsibility. Wrap the callback's user() call in a try/catch and handle cases such as invalid_grant or revoked access by clearing stored tokens and sending the user back through the login flow. The maintainer review questions whether the provider normalizes these error responses, so verify the behavior in your own environment.
- Is socialiteproviders/mailru still maintained now that Mail.ru identity is moving to VK ID?
- The package is community-maintained inside the SocialiteProviders organisation, so the practical bus factor is the org maintainers rather than a dedicated team, and per-provider attention is thin. Version 4.1.1 also shipped with an empty changelog, so read the 4.1.0 to 4.1.1 compare diff and open issues before committing long term. Ask the maintainers directly whether there is a deprecation or successor path tied to VK ID.
- Can I use socialiteproviders/mailru without already using Laravel Socialite for another provider?
- Technically yes, but the fit is low when Socialite is not already in your stack, because adopting a single community provider as the entry point to Socialite is a heavier decision than it first appears. The package is a thin adapter that plugs into Socialite via the manager, not a standalone OAuth client. It is a much better fit if you already use Socialite for Google, GitHub, or similar providers, since the integration is purely additive. If you do adopt it first, keep your controller generic so other providers can be added later.