Skip to content

Commit

Permalink
Merge pull request #5 from skni-kod/feat/token-in-cookie
Browse files Browse the repository at this point in the history
Feat/token in cookie
  • Loading branch information
Finnick223 authored Dec 11, 2024
2 parents 9be59ab + 5d24a9d commit 327ccad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Http/Controllers/GoogleAuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Models\User;
use Exception;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Support\Str;
use Laravel\Socialite\Facades\Socialite;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -35,8 +36,9 @@ public function handleGoogleCallback()

$frontendUrl = config('app.frontend_url');

// return redirect("{$frontendUrl}/login/callback")->withCookie(cookie('auth_token', $token, 60, '/', null, false, true));
return redirect("{$frontendUrl}/login/callback?token={$token}");
EncryptCookies::except('auth_token');

return redirect("{$frontendUrl}/api/login/google")->withCookie(cookie('auth_token', $token, 1, '/', null, false, true));

} catch (Exception $e) {
return response()->json([
Expand Down

0 comments on commit 327ccad

Please sign in to comment.