diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 723a290..dde832a 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -18,6 +18,9 @@ class EventServiceProvider extends ServiceProvider Registered::class => [ SendEmailVerificationNotification::class, ], + \SocialiteProviders\Manager\SocialiteWasCalled::class => [ + 'SocialiteProviders\\VKontakte\\VKontakteExtendSocialite@handle', + ], ]; /** diff --git a/composer.json b/composer.json index 9cbbd99..af610f5 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "laravel/framework": "^7.0", "laravel/socialite": "^4.3", "laravel/tinker": "^2.0", - "laravel/ui": "^2.0" + "laravel/ui": "^2.0", + "socialiteproviders/vkontakte": "^4.0" }, "require-dev": { "facade/ignition": "^2.0", diff --git a/composer.lock b/composer.lock index 1e003ed..662ec2f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ff16891063a7ade29446e4fe29ce019b", + "content-hash": "df4686093c9b4f61257454cf740b781a", "packages": [ { "name": "asm89/stack-cors", @@ -2091,6 +2091,95 @@ ], "time": "2020-02-21T04:36:14+00:00" }, + { + "name": "socialiteproviders/manager", + "version": "v3.3.4", + "source": { + "type": "git", + "url": "https://github.com/SocialiteProviders/Manager.git", + "reference": "58b72a667da292a1d0a0b1e6e9aeda4053617030" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/SocialiteProviders/Manager/zipball/58b72a667da292a1d0a0b1e6e9aeda4053617030", + "reference": "58b72a667da292a1d0a0b1e6e9aeda4053617030", + "shasum": "" + }, + "require": { + "laravel/socialite": "~3.0|~4.0", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "SocialiteProviders\\Manager\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "SocialiteProviders\\Manager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andy Wendt", + "email": "andy@awendt.com" + }, + { + "name": "Anton Komarev", + "email": "a.komarev@cybercog.su" + } + ], + "description": "Easily add new or override built-in providers in Laravel Socialite.", + "time": "2019-01-16T07:58:54+00:00" + }, + { + "name": "socialiteproviders/vkontakte", + "version": "v4.0.0", + "source": { + "type": "git", + "url": "https://github.com/SocialiteProviders/VKontakte.git", + "reference": "cc738ae8b1e72fae0f0b24d3eed26baf8e76a3ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/SocialiteProviders/VKontakte/zipball/cc738ae8b1e72fae0f0b24d3eed26baf8e76a3ef", + "reference": "cc738ae8b1e72fae0f0b24d3eed26baf8e76a3ef", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "socialiteproviders/manager": "~2.0 || ~3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "SocialiteProviders\\VKontakte\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Faust", + "email": "hello@brianfaust.de" + } + ], + "description": "VKontakte OAuth2 Provider for Laravel Socialite", + "time": "2018-05-29T17:05:01+00:00" + }, { "name": "swiftmailer/swiftmailer", "version": "v6.2.3", diff --git a/config/app.php b/config/app.php index 5757ea7..59751d4 100644 --- a/config/app.php +++ b/config/app.php @@ -175,6 +175,8 @@ return [ App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, + \SocialiteProviders\Manager\ServiceProvider::class, + ], /* diff --git a/config/services.php b/config/services.php index 2a1d616..86bfa2a 100644 --- a/config/services.php +++ b/config/services.php @@ -30,4 +30,11 @@ return [ 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], + 'vkontakte' => [ + 'client_id' => env('VKONTAKTE_KEY'), + 'client_secret' => env('VKONTAKTE_SECRET'), + 'redirect' => env('VKONTAKTE_REDIRECT_URI') + ], + + ]; diff --git a/database/migrations/2020_03_06_051421_vk.php b/database/migrations/2020_03_06_051421_vk.php new file mode 100644 index 0000000..f4a934f --- /dev/null +++ b/database/migrations/2020_03_06_051421_vk.php @@ -0,0 +1,33 @@ +string('token_passwordless')->unique()->nullable(); + $table->string('token_vk')->unique()->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('token_vk'); + }); + } +}