redirect_uri URL必须是绝对的Facebook Laravel [英] The redirect_uri URL must be absolute facebook Laravel

查看:93
本文介绍了redirect_uri URL必须是绝对的Facebook Laravel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用laravel中的Socialite与Facebook登录.首先,我设置了路由功能:

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();
   }

但是我收到错误The redirect_uri URL must be absolute

有什么想法吗?

推荐答案

好像缺少配置.

您还需要为应用程序使用的OAuth服务添加凭据.这些凭据应放置在config/services.php配置文件中,并应使用密钥facebooktwitterlinkedingooglegithubbitbucket,具体取决于应用程序所需的提供程序.例如:

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

这篇关于redirect_uri URL必须是绝对的Facebook Laravel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆