Обновление профиля Django возвращает ошибку "не авторизован

Я хотел бы обновить существующий профиль Django, но получаю сообщение об ошибке:

PUT http://127.0.0.1:8000/update_profile/ 401 (Unauthorized)

Конкретная сетевая ошибка, которую я получаю, следующая:

detail: "Authentication credentials were not provided."

Вот что срабатывает слушатель событий при нажатии на кнопку обновления профиля:

const handleSubmit = e => {
            e.preventDefault();
            console.log('handle submit',profileUser)
            const updatedProfileInfo = {
                username: profileUser.username,
                email: profileUser.email,
                first_name: profileUser.first_name,
                last_name: profileUser.last_name,
                city: profileUser.city,
                country: profileUser.country
            }
            console.log(updateProfile)
            updateProfile(updatedProfileInfo);
    }

updateProfile деструктурируется из useContext здесь:

let { user,logOutUser, updateProfile } = useContext(AuthContext)

вот функция updateProfile:

const updateProfile = (userData) => {
    axios
        .put('http://127.0.0.1:8000/update_profile/', {
            headers: {
                Authorization: "Bearer" + window.localStorage.getItem('authTokens').access,
                'Accept' : 'application/json',
                'Content-Type': 'application/json'
            },
            body: userData
            })
        .then(res => {
            console.log(res)
        })
}

Я передаю updateProfile своему профилю через ContextData:

let contextData = {
        user:user,
        loginUser:loginUser,
        logOutUser:logOutUser,
        updateToken: updateToken,
        updateProfile: updateProfile
    }
...
return(
        <AuthContext.Provider value={contextData} >
            {children}
        </AuthContext.Provider>
    )

Вот как мой маркер доступа хранится в localStorage authTokens: {"access":****,"refresh":*****}

Вернуться на верх