Hello all.
I'm using Socialite in my project, my current issue is that I have two user types and I need to set the profile type on the Provider callback.
I've seen posts suggesting using session variables but for some reason this approach is not working for me. I'm getting a different session during the Provider callback. I'm not sure what I'm doing wrong.
This is what I'm trying to do right now.
public function redirectToSocialiteProvider(Request $request, $provider)
{
$request->session()->put('profile_type', $request->input('profile_type'));
return Socialite::driver($provider)->redirect();
}
And on the callback.
public function handleSocialiteProviderCallback(Request $request, $provider)
{
dd($request->session()->all());
}
The above code just returns the _tokenwhich is different than the initial _token set before the redirect. This code is in the LoginController.
Is there any other way that I can pass custom data to the Provider callback?
Thanks!