简体   繁体   中英

The redirect_uri URL must be absolute facebook Laravel

I want to make login with facebook using Socialite in laravel. First I set the route function:

 Route::group(['middleware' => ['web']], function(){
    Route::get('auth/facebook', [
       'as' => 'auth-facebook',
       'uses' => 'usersController@redirectToProvider'
    ]);

     Route::get('auth/facebook/callback', [
       'as' => 'facebook-callback',
       'uses' => 'usersController@handleProviderCallBack'
    ]);

});

And then I make function in the user controller:

public function redirectToProvider(){
       return Socialite::driver('facebook')->redirect();
   }

But I'm getting the error The redirect_uri URL must be absolute

Any ideas?

Looks like you are missing the configuration.

You will also need to add credentials for the OAuth services your application utilizes. These credentials should be placed in your config/services.php configuration file, and should use the key facebook , twitter , linkedin , google , github or bitbucket , depending on the providers your application requires. For example:

'facebook' => [
    'client_id' => '',
    'client_secret' => '',
    'redirect' => '',
],

添加callbackURL以及clientID和clientSecret fb“:{” clientID“:” *************************“,” clientSecret“:” ** *********************************“,” callbackURL“:” // ************ / auth / facebook / callback“,” profileFields“:[” id“,” displayName“,”照片“]},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM