Laravel does not save session in POPUP

0

On my page you have 3 Login options: Email, Facebook and Google.

When I sign in via email - using Auth::attempt() - everything is fine. In this case I login for a fancybox and not for a popup .

In this fancybox there are two buttons: one for login to Facebook and one for Google. When I click on both buttons opens a popup to make the request on Facebook and return. I have already tested and is returning my data correctly when I log in. Both on Facebook and Google.

And right below when I use Auth::attempt() , I check that Auth::check() is true , and that's it!

But I programmed this popup to close alone after the requisition, hence date. When I go back to the parent page and refresh, the session is lost.

I do not know what it can be. The only thing that comes to mind is the popup .

Remembering that the same domain is on both the parent page and popup .

NOTE: Do not negate my question for lack of code. I can not now open the code to do this. But at lunch time I'll make an edit.

if(id == 'facebook')
   varWindow = window.open(urlBase + '/auth/login-facebook', '_blank', 'width=800, height=700');
else if(id == 'google')   
   varWindow = window.open(urlBase + '/auth/login-google', '_blank', 'width=800, height=700');


# Verificar se usuário já possui um login do Facebook
if(!Input::has('error')){
    $userFacebook   = Socialite::driver('facebook')->user();

    $idUserProvider = $userFacebook->user['id'];
    $password       = Hash::make($idUserProvider);

    /* 
        Verifica se já tem dados de login do usuário pelo Facebook
        Se não existir cadastra na tabela
        UID User Provider - Facebook
    */

    $verifyUser     = User::whereIdUserProvider($idUserProvider)->first();

    if($verifyUser){
        # Entra no Sistema
        Auth::user()->attempt(['email' => $verifyUser->email, 'id_user_provider' => $idUserProvider, 'password' => $idUserProvider, 'status' => 1]);
}
    
asked by anonymous 27.07.2017 / 13:27

1 answer

0

Authentication is required to use intended .

if(Auth::attempt($credentials)){
   return redirect()->intended('/painel');
}
    
29.07.2017 / 18:33