socialiteproviders/mailru
Adds Mail.ru OAuth login to Laravel Socialite. This provider lets your Laravel app authenticate users through Mail.ru using a standard Socialite driver, with configuration for client ID, secret, and redirect URI. Install via Composer and register the provider.
Package: socialiteproviders/mailru — community Laravel Socialite driver adding Mail.ru (VK Group) OAuth 2.0 login. Version under review: 4.1.1 (patch, cut 2022-05-23 against 4.1.0). Repo signals are weak: 0 stars, score 0.42, and the description confirms this is a read-only subtree split of the SocialiteProviders monorepo — no issues, no PRs, no roadmap live here.
Architecture fit. This is a thin adapter, not a framework. It registers a MailruProvider through socialiteproviders/manager, which hooks Laravel's SocialiteWasCalled event and calls Socialite::extend(). The provider maps Mail.ru's authorize/token endpoints plus a userinfo call onto a User object. Fit is high if the application already speaks Socialite (Google, GitHub, VK) — the integration is additive and Socialite::driver('mailru') is uniform with existing call sites. Fit is low if Socialite is not already in the stack: adopting a single community provider as your entry point into Socialite is a much larger architectural bet than the composer line suggests.
Integration feasibility. Straightforward and well-bounded: composer require, register the SocialiteWasCalled listener (closure form in AppServiceProvider::boot()), add a mailru block to config/services.php, register a matching redirect URI in the Mail.ru/VK ID console. No schema changes, no middleware, no workers. A developer with Socialite experience should complete a tested round trip in under a day. The time sink is never the code — it is the console-side app registration and redirect URI byte-matching.
Technical risk. The material risks are structural, not version-specific:
Key questions for maintainer/vendor.
invalid_grant, revoked access) in a way we can present to users?getEmail() reliably return an address, or is phone-only registration a real population in our target market?Stack fit. Requires PHP 8.x, Laravel with laravel/socialite, and socialiteproviders/manager. Validate declared constraints against the app's locked Socialite major before committing — Socialite has had breaking contract changes across majors and community drivers lag. If the app runs an older Laravel, expect to pin an earlier provider tag.
Migration path. Greenfield social login is the low-friction case: additive config plus a redirect/callback route pair, no data migration. If Mail.ru is joining an existing provider set, reuse the established OAuth controller/action pattern rather than writing a bespoke callback — uniform Socialite::driver() call sites preserve the ability to swap or drop a provider later. If Mail.ru is replacing a provider, treat identity re-linking as a product decision: existing users keyed on the old provider_user_id need an explicit link/merge story, not a silent updateOrCreate.
Compatibility. The realistic test matrix is {Laravel major} × {Socialite major} × {PHP minor}. Treat 4.1.1 as a low-delta patch: re-run the existing auth smoke test rather than authoring new coverage. Confirm the SocialiteWasCalled listener registers correctly under the app's service-provider discovery settings — this is the most common silent failure and looks identical to a Mail.ru-side outage.
Sequencing. Recommended order for a TPM to schedule:
social_accounts table (provider, provider_user_id, user_id, token fields) versus columns on users. Strongly prefer the separate table; it avoids a migration per future provider and correctly allows one user to link several.try/catch (Throwable) and redirect to login with a flash; an unhandled InvalidStateException is a 500 on a page users hit constantly (back button, expired session, double-click).Scope discipline. Decide the final scope list (email only, typically) before launch. Adding a scope later forces every existing user through re-consent, and adding offline-style access later means previously stored tokens cannot be refreshed. This is a one-way door and belongs in the launch checklist.
Maintenance. Low ongoing code surface, moderate ongoing attention surface. The package is a thin mapper — it will not generate tickets on its own — but it is community-maintained with no SLA, no recent release, and no visible issue tracker in this split. Plan for the possibility that a future Socialite major breaks it and you fix it (subclass the provider, override mapUserToObject()/getUserByToken(), register under a custom key) rather than waiting upstream. Budget roughly a day per year of proactive upkeep plus one reactive fix per Socialite major.
Support. Two distinct support lanes and they should be owned explicitly:
Driver [mailru] is not supported), config/services.php stale after a cached deploy, or a redirect URI mismatch. Write the runbook for these three and support cost collapses.Scaling. Negligible infrastructure impact — OAuth is a handful of synchronous HTTP calls per login. Two real considerations: (a) Mail.ru access tokens are short-lived, so if you cache them, you need a refresh path or background jobs will fail with confusing 401s far from the login event; (b) outbound calls to Mail.ru sit in the request path of the callback, so add a timeout and treat provider slowness as a login failure with a clean redirect rather than a hung request.
Failure modes to instrument.
Driver [mailru] is not supported — listener missing, provider not booted, or key case mismatch with Socialite::driver().invalid_request/invalid_grant; also check TrustProxies so Laravel generates https:// behind a load balancer..env or services.php change, config:clear locally and redeploy with a fresh config:cache. This looks exactly like a Mail.ru outage and burns hours.Invalid state — expired session, blocked cookies, cross-browser link, or a stateful redirect paired with a stateless callback. Pick one mode per entry point and never mix.updateOrCreate on email will colliding-insert or overwrite); key on provider_user_id, and treat null email as "prompt the user to confirm one" rather than inserting '' into a unique index.Ramp-up / launch readiness. Add to the launch checklist: environment variables set in all environments; redirect URI registered identically (scheme, www vs apex, trailing slash) in every console app; config:cache verified post-deploy; feature flag with a documented rollback (flag off = login button hidden, existing linked accounts unaffected); and debug-level logging of getRaw() during bring-up only — remove before production, it contains personal data.
Dependency governance. Pin the version in composer.json ("socialiteproviders/mailru": "4.1.1") rather than floating, so upgrades are deliberate. Patch releases in this monorepo are dependency-bump noise by design; the compatibility risk is never the patch number, it is a major bump of laravel/socialite or socialiteproviders/manager. Track those two as the real upgrade triggers and review the GitHub diff, not the release title.
How can I help you explore Laravel packages today?