2

I'm trying to add Facebook authetication via SocialiteProviders, but it looks like method redirectToProvider does work, but handleProviderCallback doesn't. So it redirects me to the facebook/vk page, but there are no callback.

Can you explain me, when callback method is called?

I tried to create empty file in callback method just to check it's work, but nothing happens.

public function redirectToProvider($provider) {
        return Socialite::driver($provider)->redirect();
    }

public function handleProviderCallback($provider) {
        $user = Socialite::with($provider)->user();
        $file = fopen("info.txt", "w");
        fwrite($file, $user->name);
        fwrite($file, $user->email);
        fclose($file);
    }
music_junkie
  • 189
  • 2
  • 16
  • So in your routes file you should have a route that binds to handleProviderCallback. You also need to check that it is listed in your services conf file. And that the route matches with what you supplied facebook app – ajthinking Mar 27 '19 at 11:17
  • @Anders it is in my routes file. `Route::get('/auth/{provider}/callback', 'AuthenticationController@handleProviderCallback')` What should be listed in services conf file? – music_junkie Mar 27 '19 at 12:10
  • I figured it out. I had to put url to my {provider}/callback in services.php and it worked. Thank you, @Anders – music_junkie Mar 27 '19 at 12:57

0 Answers0