简体   繁体   English

在laravel 5上使用Socialite-package for Linkedin登录

[英]Using Socialite-package for Linkedin login on laravel 5

I'm currently try to use socialite to create authentication using LinkedIn but I create the App on LinkedIn and I add the callback URL on it like this: 我目前正尝试使用社交网站使用LinkedIn创建身份验证,但我在LinkedIn上创建应用程序并在其上添加回调URL,如下所示:

http://localhost:8080/callback/linkedin 

and on config/services.php i add: 并在config / services.php上添加:

'linkedin' => [
        'client_id'     => 'xxxxx',
        'client_secret' => 'xxxxx',
        'redirect'      => 'http://localhost:8080/callback/linkedin',
    ],

I also create Routes and function (I did this for facebook and google it works fine no problem there ) But when i try to use it for LinkedIn i get this error: 我也创建路由和功能(我为Facebook做了这个,谷歌它工作正常没有问题 )但当我尝试使用它为LinkedIn我得到这个错误:

InvalidArgumentException in Manager.php line 92: Driver [linkedin] not supported.

NT: on Socialite package documentation they say that the package support linkedIn NT:在Socialite包文档上他们说包支持linkedIn

Official Documentation 官方文件

In addition to typical, form based authentication, Laravel also provides a simple, convenient way to authenticate with OAuth providers using Laravel Socialite. 除了典型的基于表单的身份验证之外,Laravel还提供了一种使用Laravel Socialite对OAuth提供程序进行身份验证的简单方便的方法。 Socialite currently supports authentication with Facebook, Twitter, LinkedIn, Google, GitHub and Bitbucket . Socialite目前支持Facebook,Twitter,LinkedIn,Google,GitHub和Bitbucket的身份验证。

@Route @路线

//social links integrations
Route::get('/social/linkedin/redirect', 'SocialAuthController@redirectToProvider');
Route::get('/social/linkedin/callback', 'SocialAuthController@handleProviderCallback');

@Controller Code @Controller代码

public function redirectToProvider() {

     return Socialite::driver('linkedin')->redirect();
}


public function handleProviderCallback(Request $request){

    try {
        $provider_user = Socialite::driver('linkedin')->user();
    } catch ( Exception $e ) {
        $request->session()->flash( 'alert-danger', 'Invalid request data detected! please try again.' );
        return redirect( '/' );
    }

    dd($provider_user);

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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