Can't send the refresh cookie from my ReactJS frontend to the Django backend

when i login the refresh cookies is set like that :

response.set_cookie(
    key="refresh",
    value=str(refresh),
    httponly=True,
    secure=False,  
    samesite="None",  
    path="/",  
)

and i tried to do and axios.js file where it verify the access then refresh it when needed like that :

// Refresh access token (cookie sent automatically)
                console.log('trying refresh')
                const res = await axios.post('http://localhost:8000/refresh/', {}, {
                    withCredentials: true
                });

                

                access = res.data.access;
                console.log('Refreshed access token:', access);

the problem is the code always gives an error on the line of refreshing, and the backend dont receive a cookie:

COOKIES: {}
None
Unauthorized: /refresh/
[15/Jan/2026 16:48:53] "POST /refresh/ HTTP/1.1" 401 29

all django seetings where set :


CORS_ALLOW_CREDENTIALS = True
CORS_ALLOWED_ORIGINS = [
    "http://localhost:3000",
]
Вернуться на верх