注销不会在 laravel 社交名流中注销
Logout doesn't logout in laravel socialite
我无法在我的应用程序中注销 google 用户,当我注销时它正在重定向登录页面说它已成功注销但是当我使用 google 按钮单击登录时它正在重定向之前登录的用户,即未注销
我的控制器代码:
class LoginController extends Controller {
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct() {
$this->middleware('guest')->except('logout','getLogout');
}
/**
* Redirect the user to the GitHub authentication page.
*
* @return \Illuminate\Http\Response
*/
public function redirectToProvider() {
return Socialite::driver('google')->redirect();
}
/**
* Obtain the user information from GitHub.
*
* @return \Illuminate\Http\Response
*/
public function handleProviderCallback() {
$user = Socialite::driver('google')->stateless()->user();
if($user) {
$authUser = $this->findOrCreateUser($user);
Auth::login($authUser, true);
}
return view ( 'home' )->withDetails ( $user )->withService ( 'google' );
// $user->token;
}
/**
* Return user if exists; create and return if doesn't
*
* @param $githubUser
* @return User
*/
private function findOrCreateUser($googleUser) {
if ($authUser = User::where('email', $googleUser->email)->first()) {
return $authUser;
}
return User::create([
'name' => $googleUser->name,
'email' => $googleUser->email,
]);
}}
我已遵循此社交登录的 laravel 文档步骤,但我无法从我的应用程序注销。任何人都可以解释为什么会发生这种情况吗??
好吧,我终于找到了 question.Actually 的解决方案,不用担心 it.Logout 代码运行良好 good.Google 帐户在获得授权后首次登录请求许可访问它不会请求许可它直接继续login.If我们注销google帐户然后它会请求许可否则它不会
我无法在我的应用程序中注销 google 用户,当我注销时它正在重定向登录页面说它已成功注销但是当我使用 google 按钮单击登录时它正在重定向之前登录的用户,即未注销
我的控制器代码:
class LoginController extends Controller {
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct() {
$this->middleware('guest')->except('logout','getLogout');
}
/**
* Redirect the user to the GitHub authentication page.
*
* @return \Illuminate\Http\Response
*/
public function redirectToProvider() {
return Socialite::driver('google')->redirect();
}
/**
* Obtain the user information from GitHub.
*
* @return \Illuminate\Http\Response
*/
public function handleProviderCallback() {
$user = Socialite::driver('google')->stateless()->user();
if($user) {
$authUser = $this->findOrCreateUser($user);
Auth::login($authUser, true);
}
return view ( 'home' )->withDetails ( $user )->withService ( 'google' );
// $user->token;
}
/**
* Return user if exists; create and return if doesn't
*
* @param $githubUser
* @return User
*/
private function findOrCreateUser($googleUser) {
if ($authUser = User::where('email', $googleUser->email)->first()) {
return $authUser;
}
return User::create([
'name' => $googleUser->name,
'email' => $googleUser->email,
]);
}}
我已遵循此社交登录的 laravel 文档步骤,但我无法从我的应用程序注销。任何人都可以解释为什么会发生这种情况吗??
好吧,我终于找到了 question.Actually 的解决方案,不用担心 it.Logout 代码运行良好 good.Google 帐户在获得授权后首次登录请求许可访问它不会请求许可它直接继续login.If我们注销google帐户然后它会请求许可否则它不会