Socialite callback test

This commit is contained in:
Čarodej
2021-12-31 12:23:44 +01:00
parent 22ae148a22
commit 22733619d1
8 changed files with 1355 additions and 961 deletions

View File

@@ -21,13 +21,17 @@ class SocialiteAuthenticationController extends Controller
return response()->json([
'url' => $url
], 200);
]);
}
public function callback($provider)
{
// Get socialite user
$provider_user = Socialite::driver($provider)->stateless()->user();
if (app()->runningInConsole()) {
$provider_user = Socialite::driver($provider)->user();
} else {
$provider_user = Socialite::driver($provider)->stateless()->user();
}
// Check if user exist already
$user = User::whereEmail($provider_user->email)->first();