Kumar Abhirup
Kumar Abhirup

Reputation: 308

Class App\Http\Controllers\SocialFacebookAccountService does not exist error in laravel

I am using Socialite for Logging in my users with Facebook. I have done all the processes needed to built the functionality. When I click on "Login with Facebook", it asks for permission and giving permissions on facebook, it redirects me too an error.

This is the error link: http://localhost:8888/under_dev/mytaswir/public/callback?code=AQDupltbruPf7MokV6N-Mlmrcmqu-QFeKyImrMz8Yp3ViAv128lZBDfPS88Su1q60o6EfFL0_KIy2YH7lztGJrdj0ZDUFZDjR2ucMobLpUGyzPc39ABElZBJko3llqB5xehmZxJMuay7lBHybZ7F6AMxrCN2H0bNhPFPts5_v6Zmb0kfFR7H2A-ha4EXbJzTX6Y98SY9G50HWP1v-KqcUt5ozXfsNIldR19O_dMCEunGLTsf2sKLK76ObEwPdERhW-XzhJv-IdzeHU-Ppw91TWYHjWvBbEajwQH9N-p91VjWNaede7zOKfCBYUiOedzlLRDfz1qv9QghjmceULRk-DwldD0hY1nBv_jSJwVtq_FLhQ&state=UkCIOpg6dqle5dStyvbgtc9se0OiLxGwqWUZyTli#=

This is the error screenshot: It gives out an error: **Class App\Http\Controllers\SocialFacebookAccountService does not exist** It gives out an error: **Class App\Http\Controllers\SocialFacebookAccountService does not exist!

I have made all my Controllers, Service Providers, Aliases, etc.. in the way suggested on this article.

Please help me get rid of this error. I want the programme to log in my Facebook User into the dashboard.

If you want to see the files, see this git commit.

Thanks in advance.

Upvotes: 0

Views: 1913

Answers (1)

C3roe
C3roe

Reputation: 96316

I think you are missing the namespace here: https://github.com/KumarAbhirup/myTaswir/blob/c07b2b5a3dd38f70dd0f26eed2eeb983469993ab/app/Http/Controllers/SocialAuthFacebookController.php#L26

  /**
   * Return a callback method from facebook api.
   *
   * @return callback URL from facebook
   */
  public function callback(SocialFacebookAccountService $service)

This method belongs to App\Http\Controllers\SocialAuthFacebookController, so when the system tries to resolve the class name SocialFacebookAccountService from that "location", it will result in App\Http\Controllers\SocialFacebookAccountService, and that does not exist.

The class is actually in the namespace \App\Services, so you must also use that in this place:

  public function callback(\App\Services\SocialFacebookAccountService $service)

Edit: Fixed error regarding missing leading \, to refer the fully qualified namespace

Upvotes: 1

Related Questions