covobo / socialite-mailru
Mail.ru OAuth2 Provider for Laravel Socialite
Installs: 95
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/covobo/socialite-mailru
Requires
- php: ^5.6 || ^7.0
- socialiteproviders/manager: ~3.0
This package is auto-updated.
Last update: 2025-12-12 09:50:04 UTC
README
Difference with jhaoda/socialite-mailru
The package jhaoda/socialite-mailru supports only legacy mailru OAuth2 based on connect.mail.ru authentification.
This package works with actual mailru OAuth2 based on oauth.mail.ru.
Package details
This package does not support additional mailru security feature "state". Package uses adhoc solution to pass mailru validation.
Installation
1. Setup your application on mail.ru
See details here https://oauth.mail.ru/app/
2. Install package
composer require covobo/socialite-mailru
3. Service Provider
- Remove
Laravel\Socialite\SocialiteServiceProviderfrom yourproviders[]array inconfig\app.phpif you have added it already. - Add
SocialiteProviders\Manager\ServiceProviderto yourproviders[]array inconfig\app.php.
For example:
'providers' => [ // a whole bunch of providers // remove 'Laravel\Socialite\SocialiteServiceProvider', SocialiteProviders\Manager\ServiceProvider::class, // add ];
- Note: If you would like to use the Socialite Facade, you need to install it.
4. Add the Event and Listeners
-
Add
SocialiteProviders\Manager\SocialiteWasCalled::classevent to yourlisten[]array in<app_name>/Providers/EventServiceProvider. -
Add your listeners (i.e. the ones from the providers) to the
SocialiteProviders\Manager\SocialiteWasCalled[]that you just created. -
The listener that you add for this provider is
Covobo\SocialiteProviders\MailRu\MailRuExtendSocialite::class. -
Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers.
For example:
/** * The event handler mappings for the application. * * @var array */ protected $listen = [ SocialiteProviders\Manager\SocialiteWasCalled::class => [ Covobo\SocialiteProviders\MailRu\MailRuExtendSocialite::class ], ];
5. Services Array and .env
Add to config/services.php:
'mailru' => [ 'client_id' => env('MAILRU_CLIENT_ID'), 'client_secret' => env('MAILRU_CLIENT_SECRET'), 'redirect' => env('MAILRU_REDIRECT'), ],
Append provider values to your .env file:
// other values above
MAILRU_CLIENT_ID=application_id
MAILRU_CLIENT_SECRET=application_secret
MAILRU_REDIRECT=https://yoursite.com/callback