Why is my useEffect entering an infinite loop despite empty dependency list?

My RequireAuth is a route protector. However, upon trying to visit one of the protected routes, it ends up causing an infinite loop, flooding my console.

This is my route protector.

import { Navigate, Outlet, useLocation } from "react-router-dom";
import useAuth from "../hooks/useAuth";
import axios from "../api/axios";
import { useEffect, useState } from "react";

const RequireAuth = ({allowedRole}) => {
    const { getRole, getUser, getToken } = useAuth();
    const location = useLocation();

    const [isAuthenticated, setIsAuthenticated] = useState(false);

    useEffect(() => {
        
        const token = getToken(); 
        const verifyToken = async () => {

            try {
                const response = await axios.get("/api/verifyToken", {
                    headers: {
                        Authorization: `Bearer ${token}`,
                    },
                });

                setIsAuthenticated(response.data.valid);
            } catch (error) {
                console.error("Error verifying token:", error);
            }
        };

        verifyToken();
    }, []);


    return isAuthenticated ? (
    allowedRole?.includes(getRole()) ? (
      <Outlet />
    ) : getUser() ? (<Navigate to="/unauthorized" state={{ from: location }} replace />) 
                  : (<Navigate to="/login" state={{ from: location }} replace />)
    ) : (
    <Navigate to="/login" state={{ from: location }} replace />
    );
}

export default RequireAuth;

This is my getToken method

const getToken = () => {
        console.log('getting token');
        return auth ? auth?.token : null;
    };

this is the error i am getting in my console

AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
RequireAuth.js:18 
        
        
       GET http://localhost:3500/api/verifyToken 403 (Forbidden)
dispatchXhrRequest @ xhr.js:188
xhr @ xhr.js:15
dispatchRequest @ dispatchRequest.js:51
_request @ Axios.js:173
request @ Axios.js:40
Axios.<computed> @ Axios.js:199
wrap @ bind.js:5
verifyToken @ RequireAuth.js:18
(anonymous) @ RequireAuth.js:30
commitHookEffectListMount @ react-dom.development.js:23189
commitPassiveMountOnFiber @ react-dom.development.js:24965
commitPassiveMountEffects_complete @ react-dom.development.js:24930
commitPassiveMountEffects_begin @ react-dom.development.js:24917
commitPassiveMountEffects @ react-dom.development.js:24905
flushPassiveEffectsImpl @ react-dom.development.js:27078
flushPassiveEffects @ react-dom.development.js:27023
(anonymous) @ react-dom.development.js:26808
workLoop @ scheduler.development.js:266
flushWork @ scheduler.development.js:239
performWorkUntilDeadline @ scheduler.development.js:533
Show 18 more frames
Show less

Understand this error

AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
AuthProvider.js:49 getting token
react-dom.development.js:86 Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.
    at Navigate (http://localhost:3000/static/js/bundle.js:74588:5)
    at RenderedRoute (http://localhost:3000/static/js/bundle.js:74023:5)
    at Outlet (http://localhost:3000/static/js/bundle.js:74627:26)
    at div
    at div
    at Layout
    at RenderedRoute (http://localhost:3000/static/js/bundle.js:74023:5)
    at Routes (http://localhost:3000/static/js/bundle.js:74714:5)
    at App (http://localhost:3000/static/js/bundle.js:53:66)
    at RenderedRoute (http://localhost:3000/static/js/bundle.js:74023:5)
    at Routes (http://localhost:3000/static/js/bundle.js:74714:5)
    at AuthProvider (http://localhost:3000/static/js/bundle.js:4232:3)
    at Router (http://localhost:3000/static/js/bundle.js:74648:15)
    at BrowserRouter (http://localhost:3000/static/js/bundle.js:72601:5)

Here are some other errors that appear in the sea of other errors:

Throttling navigation to prevent the browser from hanging. See https://crbug.com/1038223. Command line switch --disable-ipc-flooding-protection can be used to bypass the protection
Failed to load resource: the server responded with a status of 403 ()
Error verifying token: AxiosError

I have tried adding logging statements to my backend, and realise the request is not even being received by the backend for some reason as the logging statements are not appearing.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật