2016-04-10 14 views
3

ich zur Zeit bin versuchen Persönlichkeit des öffentlichen Lebens verwenden Authentifizierung mit LinkedIn zu erstellen, aber ich die App auf LinkedIn erstellen und ich fügen Sie den Callback-URL auf es wie folgt aus:Mit Socialite-Paket für Linkedin Login auf Laravel 5

http://localhost:8080/callback/linkedin 

und auf config/services.php ich hinzufügen:

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

ich auch Routen und Funktion erstellen (I dies für Facebook tat und google es funktioniert gut, kein Problem, da) Aber wenn ich versuche, es zu benutzen für LinkedIn ich bekomme thi s Fehler:

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

NT: auf Socialite Paketdokumentation sie sagen, dass das Paket Unterstützung 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. Socialite currently supports authentication with Facebook, Twitter, LinkedIn, Google, GitHub and Bitbucket.

+0

Socialite unterstützt das, aber Linkedin ist nicht eingebaut. Sie können das aktuelle Socialite-Paket damit erweitern: [socialiteproviders für LinkedIn] (http://socialiteproviders.github.io/providers/linkedin/) – Sovon

+0

@Sovon ja, ich finde diese Lösung schon aber es wird nicht andere Fahrer von Facebook und Twitter und Google überschreiben? –

+0

Ich habe es nicht getestet. Aber, hoffentlich wird es nicht. Es wird nur erweitert. – Sovon

Antwort

0

@Route

//social links integrations 
Route::get('/social/linkedin/redirect', '[email protected]'); 
Route::get('/social/linkedin/callback', '[email protected]'); 

@Controller-Code

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

}