Php Laravel Socialist如何在重定向到提供程序后在会话中保留变量
欢迎Php Laravel Socialist如何在重定向到提供程序后在会话中保留变量,php,laravel,session,laravel-socialite,Php,Laravel,Session,Laravel Socialite,欢迎 我正在开发一个multi-lang网站,目前正在使用社交媒体登录() 问题是: 在登录Google之前,我在会话中保存了一个变量locale('en'、'fr'…等)。 但是在登录并从Google重定向到我的站点后,我发现我在会话中输入的变量值是null 使用以下代码 /* this method will redirect user from my website to google for auth */ public function redirectToGoogle
我正在开发一个multi-lang网站,目前正在使用社交媒体登录()
问题是:
在登录Google之前,我在会话中保存了一个变量
locale
('en'、'fr'…等)。
但是在登录并从Google重定向到我的站点后,我发现我在会话中输入的变量值是null
使用以下代码
/* this method will redirect user from my website to google for auth */
public function redirectToGoogleProvider()
{
Session::put("locale", app()->getLocale());
return Socialite::driver('google')->redirect();
}
/* this method will called when auth finished */
public function handleGoogleProviderCallback()
{
$locale = Session::get('locale');
dd($locale); // output: null
}
edit:我在使用cookie
多谢各位