Session 重定向laravel 5.4后的身份验证会话数据刷新

Session 重定向laravel 5.4后的身份验证会话数据刷新,session,authentication,laravel-5.4,Session,Authentication,Laravel 5.4,我正在使用Laravel5.4,并使用auth登录用户 $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); $.ajax({ type: "POST", url: "./post_xing_res"

我正在使用Laravel5.4,并使用auth登录用户

$.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
      });
         $.ajax({
                     type: "POST",
                     url: "./post_xing_res",
                     data: {user_data:response},

                     success: function(msg){
                      console.log(msg);
                      if(msg == 1)
                      {
                        location.href='http://192.168.1.12/maulik_proj/studicash_new/public/welcome';
                      } 
                     }
                });
       }
正如您在上面看到的,我在
post\u xing\u res
中调用了ajax,我正在使用auth,如下所示 $created_at=$updated_at=time()

/if(请求::ajax()){/

你能帮我摆脱这个问题吗 提前谢谢

    $data = Input::all(); 
    $check_acc_first = DB::table('users')
        ->where('login_with',3)
        ->where('xing_id',$data['user_data']['user']['id'])
        ->first();

    if ($check_acc_first) {
        Auth::loginUsingId($check_acc_first->user_id);
        echo "<pre>";print_r(Auth::user());
    }
    else {
        $insert_user = DB::table('users')->insertGetId(
                            array('login_with' => 3, 'xing_id' => $data['user_data']['user']['id'], 'profile_pic' => $data['user_data']['user']['photo_urls']['maxi_thumb'],'first_name' => $data['user_data']['user']['first_name'],'last_name' => $data['user_data']['user']['last_name'],'email' => $data['user_data']['user']['active_email'],'created_at'=>$created_at,'updated_at'=>$updated_at)
                        );

        $user_data = DB::table('users')
                        ->where('user_id',$insert_user)
                        ->get();
        //echo "<pre>";print_r($user_data);
        Auth::loginUsingId($user_data->user_id);
    }
    if (Auth::check()) {

        echo 1;
         exit;
    }
Route::middleware('guest')->group(function () {

    Route::post('/post_xing_res','SocialAuthController@postXingRes');

});

    Route::get('/welcome',function(){
        return view('welcome');
    });