googleAuthService->exchange( $request->validated('oauth_code'), $request->validated('tenant_codigo'), ); $guestTokenCookie = $request->cookie('guest_token'); $guestToken = is_string($guestTokenCookie) && $guestTokenCookie !== '' ? $guestTokenCookie : null; $this->guestCartMergeService->merge( $authentication['tenant_codigo'], $authentication['user'], $guestToken, ); $response = response()->json([ 'message' => 'Sesion iniciada correctamente.', 'token' => $authentication['token'], 'token_type' => 'Bearer', 'user' => UserResource::make($authentication['user']), ]); if ($guestToken !== null) { $response->withCookie(Cookie::forget('guest_token')); } return $response; } }