0

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.

Kumar Abhirup
  • 308
  • 1
  • 4
  • 16

1 Answers1

1

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

CBroe
  • 91,630
  • 14
  • 92
  • 150
  • Now it gives a different error: Class App\Http\Controllers\App\Services\SocialFacebookAccountService does not exist – Kumar Abhirup Mar 11 '18 at 09:59
  • Sorry, leading \ missing - `public function callback(\App\Services\SocialFacebookAccountService $service)` should do the trick then. – CBroe Mar 11 '18 at 10:08
  • thanks a lot for ur help.. but just some more plz.. now this error comes: **The use statement with non-compound name 'Socialize' has no effect** – Kumar Abhirup Mar 11 '18 at 10:09
  • See https://stackoverflow.com/questions/9317022/troubleshooting-the-use-statement-with-non-compound-name-has-no-effect – CBroe Mar 11 '18 at 10:12
  • hey, I read that already. But that didnt helped.. see this git commit. You might find my mistake here... https://github.com/KumarAbhirup/myTaswir/tree/25c89f3f0463a5728908fbff7a86ecf7b2355462 – Kumar Abhirup Mar 11 '18 at 10:16
  • Hey, finally after trying hundreds of time, got everything I need. You had a mojor role in solving my problem! – Kumar Abhirup Mar 12 '18 at 09:12