]> _ Git - cubist_socialite.git/commitdiff
wip #4765
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 11 Oct 2021 12:15:20 +0000 (14:15 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 11 Oct 2021 12:15:20 +0000 (14:15 +0200)
composer.json
routes/socialite.php
src/CubistSocialiteAuthServiceProvider.php [deleted file]
src/Http/Controllers/SocialiteController.php

index 46be5ccf160b4dc74272a197bf634283e16c4d2e..04f690f8ecaaf023914c5946bb017279cc77a9d1 100644 (file)
@@ -26,8 +26,7 @@
         "barryvdh/laravel-debugbar": "^3.6",
         "mpyw/null-auth": "^2.0",
         "spatie/laravel-permission": "^4.0|^5.1",
-        "laravel/framework": "^8.63",
-        "cubist/cms-back": "dev-master"
+        "laravel/framework": "^8.63"
     },
     "repositories": [
         {
@@ -39,7 +38,6 @@
         "laravel": {
             "providers": [
                 "Cubist\\Socialite\\CubistSocialiteServiceProvider",
-                "Cubist\\Socialite\\CubistSocialiteAuthServiceProvider"
             ]
         }
     }
index a3718d947197cf8fe7311897f28b2ca60425f1e4..89e0f2c5693cdb9b1c6704ef03d726fb407f56a9 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
 Route::group(['namespace' => 'Cubist\Socialite\Http\Controllers','middleware' => ['web']], function () {
-    Route::get("socialite/login", "SocialiteController@login");
-    Route::get("socialite/redirect/{provider}", "SocialiteController@redirect")->name('socialite.redirect');
     Route::get("socialite/callback/{provider}", "SocialiteController@callback")->name('socialite.callback');
 });
\ No newline at end of file
diff --git a/src/CubistSocialiteAuthServiceProvider.php b/src/CubistSocialiteAuthServiceProvider.php
deleted file mode 100644 (file)
index 7a25c2a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-namespace Cubist\Socialite;
-
-use Illuminate\Foundation\Support\Providers\AuthServiceProvider;
-use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Auth;
-use Laravel\Socialite\Facades\Socialite;
-
-class CubistSocialiteAuthServiceProvider extends AuthServiceProvider
-{
-    /**
-     * Register any application authentication / authorization services
-     *
-     * @return void
-     */
-    public function boot()
-    {
-        $this->registerPolicies();
-
-        Auth::viaRequest('socialitegoogle', function (Request $request) {
-            try {
-                $user= User::fromProvider('google');
-                debug('viarequest/socialitegoogle',$user);
-                return $user;
-            } catch (\Exception $e) {
-                return null;
-            }
-        });
-    }
-}
\ No newline at end of file
index 9afaf6eec6875a4e07783fd541fddc696f4ff4b6..a16fc598b68d703325f5fdbe5ee84a0111a95764 100644 (file)
@@ -11,21 +11,6 @@ class SocialiteController extends Controller
 {
     protected $providers = ["google"];
 
-    public function login()
-    {
-        return view(CubistSocialiteServiceProvider::NAMESPACE . "::login");
-    }
-
-    public function redirect()
-    {
-        $provider = request()->provider;
-        if (in_array($provider, $this->providers, true)) {
-            return Socialite::driver($provider)->stateless()->redirect();
-        }
-        abort(403);
-    }
-
-
     public function callback()
     {
         $provider = request()->provider;
@@ -36,7 +21,7 @@ class SocialiteController extends Controller
                 Auth::login($authUser, true);
                 return redirect('/test');
             } catch (\Exception $e) {
-                dd($e);
+                return Socialite::driver($provider)->stateless()->redirect();
             }
         }
     }