Sven0188's avatar

Socialite = return parameters in Callback

Hi to All :)

May I ask - is there a way of me to pass my own form input values to the Socialite provider (Facebook for now) and then receive those parameters in my callback uri again?

I have a multi step sign up form and would not want to user to Login on the first step but only on the second step. Challenge here is though I need to somehow remember the input values on step one after authentication via Facebook :)

Or should I make use of Session variables rather? Or what else can you Geniuses suggest here?

Thanks All!

0 likes
2 replies
TadasPaplauskas's avatar

I've encountered a problem like this before. After some research I did not find any way to do that with Socialite (maybe it has implemented this feature since, dunno), so I went with sessions:

public function redirectToFacebookProvider()
{
    // save anything you will need later, for example an url to come back to
    Session::put('url.intended', URL::previous());

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

public function handleFacebookProviderCallback()
{
    // handling....

    $url = Session::get('url.intended', url('/'));
    Session::forget('url.intended');

    return redirect($url);
}
2 likes
rahulsharma841990's avatar

i am not sure about facebook, but for github its working fine. Try this:

public function socialLogin($loginFrom){
      return Socialite::driver('github')
               ->redirectUrl('http://your-domain.com/callback?data=123')
               ->redirect();
}

on github app you need to put only: http://your-domain.com/callback

1 like

Please or to participate in this conversation.