Try to change user Data (401 unathorised)

I try change user data (name, email, nickname and picture), but response is 401 unauthorized
My request:

const data: any = await axiosInstance.patch(
        https://MY_DOMAIN/api/v2/users/ + req.query.id,
        {
            name: req.body.name,
            email: req.body.email,
            nickname: req.body.nickname,
            picture: req.body.picture
        },
        {
            headers: {
                "content-type": "application/json",
                "WWW-Authenticate": `Bearer ${req.cookies.appSession}`
            }
        }
    )

Response: 
data: {
      statusCode: 401,
      error: 'Unauthorized',
      message: 'Missing authentication'
    }
1 Like

Hey @ph1, Welcome to the Auth0 Community!

Have you included an Access token in the Authorization header of this request?

Regards,
Sid

Add Authorization

        Endpoints.UPDATE_USER + req.query.id,
        {
            name: req.body.name,
            email: req.body.email,
            nickname: req.body.nickname,
            picture: req.body.picture,
            connection: "Username-Password-Authentication"
        },
        {
            headers: {
                "Content-Type": "application/json",
                "Authorization": `Bearer ${req.cookies.appSession}`
            }
        }
    )

Response
data: {
      statusCode: 400,
      error: 'Bad Request',
      message: 'Bad HTTP authentication header format',
      errorCode: 'Bearer'
    }