I am doing a social network login using laravel Socialite, however I need to save a variable that is the origin of the page where you are registering.
According to the documentation, I have the following methods in my controller.
public function redirectToProvider($provider, $origen)
{
session_start();
$_SESSION['origen'] = $origen;
return Socialite::driver($provider)->redirect();
}
This function is executed when entering the login URL that has the following form
https://mi-dominio.com/auth/red-social/origen
As you can see in the redirectToProvider method, I make a session in which I keep the origin.
I would like this set to be done this way.
protected $provider, $origen;
public function __construct(Request $request)
{
$argumentes = $request->route()->parameters();
$this->provider = $argumentes['provider'];
$this->origen = $argumentes['origen'];
}
Not to use sessions, but the problem is that the instance is lost when I leave the domain to the domain of the social network. And when it returns, the values of $ provider and $ origin are in null so I can not reuse them anymore.
Someone has some idea of how I can do this without losing the instance.