Laravel 8: Undefined class ‘Socialite’

  laravel, laravel-8, laravel-socialite, php

I’m working with Laravel 8 to develop my project, and I want to make a Login system with Google Authentication API so I just downloaded socialite package by using composer require laravel/socialite.

Then I created my controller called GoogleAuthController:

namespace AppHttpControllersAuth;

use AppHttpControllersController;
use IlluminateHttpRequest;
use Socialite;

class GoogleAuthController extends Controller
{
    public function redirect()
    {
        return Socialite::driver('google')->redirect();
    }

    public function callback()
    {

    }
}

But PhpStorm says: Undefined class ‘Socialite’

So why is that? How to fix it?

Source: Laravel

Leave a Reply