From: Vincent Vanwaelscappel Date: Thu, 7 Oct 2021 14:32:51 +0000 (+0200) Subject: wip #4765 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=995e68d2d6b4f6178379c22289c2a366618078fa;p=cubist_socialite.git wip #4765 @0.5 --- diff --git a/.idea/cubist_socialite.iml b/.idea/cubist_socialite.iml index d6ebd48..846927c 100644 --- a/.idea/cubist_socialite.iml +++ b/.idea/cubist_socialite.iml @@ -2,7 +2,79 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/views/login.blade.php b/resources/views/login.blade.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/resources/views/login.blade.php @@ -0,0 +1 @@ +name('socialite.redirect'); +Route::get("socialite/callback/{provider}", "SocialiteController@callback")->name('socialite.callback'); \ No newline at end of file diff --git a/src/Http/Controllers/SocialiteController.php b/src/Http/Controllers/SocialiteController.php new file mode 100644 index 0000000..0f2a6da --- /dev/null +++ b/src/Http/Controllers/SocialiteController.php @@ -0,0 +1,41 @@ +provider; + if (in_array($provider, $this->providers)) { + return Socialite::driver($provider)->redirect(); + } + abort(403); + } + + + public function callback(Request $request) + { + + $provider = $request->provider; + if (in_array($provider, $this->providers)) { + $data = Socialite::driver($request->provider)->user(); + $user = $data->user; + dd($user); + } + abort(403); + } +} \ No newline at end of file diff --git a/src/SocialiteServiceProvider.php b/src/SocialiteServiceProvider.php index e4880ab..8ac9e1c 100644 --- a/src/SocialiteServiceProvider.php +++ b/src/SocialiteServiceProvider.php @@ -7,4 +7,23 @@ use Illuminate\Support\ServiceProvider; class SocialiteServiceProvider extends ServiceProvider { + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = false; + + const NAMESPACE = 'cubist_socialite'; + + public function boot() + { + $base = realpath(__DIR__ . "/.."); + $resourcesDir = $base . '/resources'; + + $this->loadTranslationsFrom(realpath($resourcesDir . '/lang'), self::NAMESPACE); + $this->loadRoutesFrom($base . '/routes/socialite.php'); + //$this->publishes([$resourcesDir . '/config/cubist.php' => config_path('cubist.php')], 'config'); + $this->loadViewsFrom(realpath($resourcesDir . '/views'), self::NAMESPACE); + } } \ No newline at end of file