Laravel not saved POPUP session

Asked

Viewed 73 times

0

On my page you have 3 login options: E-mail, Facebook and Google.

When I log in by email - using Auth::attempt() - everything goes well. In this case I log in for a fancybox and not for a popup.

This fancybox has two buttons: one login to Facebook and the other to Google. When I click on both buttons open a popup to make the request on Facebook and return. I have tested and is correctly returning my data when I login. On Facebook and Google.

And just below when I use the Auth::attempt(), check whether the Auth::check() is true, and is!

But I programmed this popup to close alone after the request, then closes. When I go back to the parent page and update, the session is lost.

I don’t know what it can be. The only thing that comes to mind is the popup.

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

NOTE: don’t deny my question for lack of code. I can’t open the code now to do this. But at lunchtime I will do 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]);
}
  • 1

    Diego, your problem is the same as this post, well I believe: https://stackoverflow.com/questions/13848969/session-variables-lost-in-popup-window/14005284. Take a look at the answer, well able to be the same thing.

  • @Brunorigolon and you solved ?

1 answer

0


The use of the intended.

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.