Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 用户在通过laravel Socialist登录重定向后未登录_Php_Laravel_Oauth 2.0_Laravel 7_Laravel Socialite - Fatal编程技术网

Php 用户在通过laravel Socialist登录重定向后未登录

Php 用户在通过laravel Socialist登录重定向后未登录,php,laravel,oauth-2.0,laravel-7,laravel-socialite,Php,Laravel,Oauth 2.0,Laravel 7,Laravel Socialite,您好,我正在使用Laravel Socialite与我的远程Laravel Paspport应用程序进行Oauth身份验证。在成功地使用passport对用户进行身份验证后,当我想让用户访问应用程序时,它会将我重定向回登录,并充当他注销的角色。客户端(社交名流在这个git上)我尝试在设置中切换域,但没有任何效果。在我实现Oauth之前,它工作得很好。我想用社交名媛来形容我 我希望这是你所需要的一切,但如果有什么让我知道,我会补充更多的信息 Laravel7.x,PHP7.2 这是我的登录控制器

您好,我正在使用Laravel Socialite与我的远程Laravel Paspport应用程序进行Oauth身份验证。在成功地使用passport对用户进行身份验证后,当我想让用户访问应用程序时,它会将我重定向回登录,并充当他注销的角色。客户端(社交名流在这个git上)我尝试在设置中切换域,但没有任何效果。在我实现Oauth之前,它工作得很好。我想用社交名媛来形容我 我希望这是你所需要的一切,但如果有什么让我知道,我会补充更多的信息 Laravel7.x,PHP7.2

这是我的登录控制器

  public function redirectToProvider()
    {
        return Socialite::driver('laravelpassport')->redirect();
    }

    /**
     * Obtain the user information from Passport
     *
     * @return \Illuminate\Http\Response
     */
    public function handleProviderCallback(Request $request)
    {
        try {
            $userSocial  = Socialite::driver('laravelpassport')->stateless()->user();
        } catch (\Exception $e) {
             return redirect('/login')->withError($e->getMessage());
        }


        $users  =   User::where(['email' => $userSocial->getEmail()])->first();

        if($users){
            Auth::login($users,true);

        }else{
            $user = User::create([
                'email'         => $userSocial->getEmail(),
                'provider_id'   => $userSocial->getId()
            ]);
            Auth::login($user,true);

        }
        //session(['current_user' => $userSocial]);
        return redirect('/');

    }

好的,我试着将我的应用程序部署到服务器上,但没想到它居然成功了。。问题可能在于本地会话