vendredi 17 mai 2019

How to link a Social Media account using Laravel Socialite

I'm using Laravel Socialite to let the user login using fb, twitter or google which works well. But, there's part of the application that allows the user to link its other social account if they also want to use them when logging in, in short multiple sign in options for a single account. My problem now is, I don't know how to attain since I really don't have idea and I can't find some guide in the internet. I have tried re-using the callback function but it is not even getting inside the function. Here's what I have tried:

 public function linkMedia(Request $request, SocialMedia $social)
 {
    $provider = $request->route('provider');


    return Socialite::driver($provider)->with(['type' => "link"])->redirect();
}

//callback function with my sign up with social media
public function handleProviderCallback(Social $service, $provider)
{
    try {
        $user = Socialite::driver($provider)->user();
    } catch (\Exception $e) {
        return redirect('/')->withErrors([__('names.generalError')]);
    }
    dd($user);
}

If you have some suggestions or resources for tutorials, please let me know. Thank you in advance for your help. Been stuck for 2 days now.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire