The redirect_uri URL must be absolute facebook Laravel

♀尐吖头ヾ 提交于 2019-12-13 07:20:57

问题


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?


回答1:


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' => '',
],



回答2:


Add callbackURL along with clientID and clientSecret fb": { "clientID": "*************************", "clientSecret": "*******************************", "callbackURL": "//************/auth/facebook/callback", "profileFields": ["id", "displayName", "photos"] },



来源:https://stackoverflow.com/questions/40589097/the-redirect-uri-url-must-be-absolute-facebook-laravel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!