Hello there, I’m using the API management v2 of Auth2 to retrieve and update users from my client-side using React. I am having a problem updating the user_metadata. This is the error message that I receive after sending the PATCH request " has been blocked by CORS policy: Method PATCH is not allowed by Access-Control-Allow-Methods in preflight response." I do not know what I am doing wrong
This is the code from client side:
const updateUser = async () => {
const userID = user.sub;
const options = {
method: "PATCH",
url: `https://example.us.auth0.com/api/v2/users/${userID}`,
headers: {
"content-type": "application/json",
authorization: Bearer <API TOKEN>
},
body: {
user_metadata: { cus_id: "secret key" },
},
};
await axios
.request(options)
.then((response) => {
console.log(response);
})
.catch(function (error) {
console.error(error);
});
};
I also set both “web origins” and “cors origins” in my auth0 application to the correct URL.
Everything works fine if I send the PATCH request from POSTMAN. but it does not work from my production environment URL. I am using only the client-side for this application and auth0 integration.
if anyone could help, please comment on the post
Thanks.