title: Laravel 9 Socialite google login and jenssegers-mongodb not working
body: <p>I am using laravel and MongoDB in my project. for MongoDB
  i am using jenssegers/laravel-mongodb. But now I am facing an error when I am trying to do a google login using Laravel socialite. In Laravel Controller this is my code in SocialController.php</p>
  <pre><code>namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use Validator, Redirect, Response, File;
  use Auth;
  use Str;
  use App\Models\User;
  use Laravel\Socialite\Facades\Socialite;
  
  class SocialController extends Controller
  {
      public function redirect()
      {
          return Socialite::driver('google')-&gt;redirect();
      }
  
      public function googleCallback()
      {
          try {
              $google_user = Socialite::driver('google')-&gt;user();
              $google_user_id = $google_user-&gt;id;
              $active_user = User::where('is_active','=','yes')-&gt;where('google_id','=',$google_user_id)-&gt;first();
              $pending_user = User::where('is_active','=','no')-&gt;where('google_id','=',$google_user_id)-&gt;first();
              if ($active_user) {
                  Auth::login($active_user);
                      return redirect('dashboard');
              } elseif ($pending_user){
                      return redirect('message')-&gt;with(['message' =&gt; 'google_message']);
              } else {
                  $new_user = User::create([
                      'name' =&gt; ucwords($google_user-&gt;name),
                      'email' =&gt; $google_user-&gt;email,
                      'google_id' =&gt; $google_user-&gt;id,
                      'email_verified_at' =&gt; now(),
                      'password' =&gt; '97d0818e1ffeb96132ceab8bb4b02a69', // password
                      'remember_token' =&gt; Str::random(10),
                  ]);
                  Auth::login($new_user); 
                     //return redirect('login'); 
                      return redirect('message')-&gt;with(['message' =&gt; 'google_message']);
              }
          } catch (\Throwable $th) {
              abort(404);
          }
      }    
  }
  </code></pre>