title: Why do I get Error 401 trying to patch Auth0 app_metadata with the Management API?
body: <p>I'm banging my head against the wall trying to solve issuing a patch request after getting an access token. This same access token works for get requests to https://${appDomain}/api/v2/users/${userid}. But it fails with &quot;Request failed with status code 401&quot; when trying to use it to patch app_metadata.</p>
  <p>Using NodeJS and Axios.</p>
  <pre class="lang-js prettyprint-override"><code>         axios
            .post(`https://${appDomain}/oauth/token`, {
              grant_type: 'client_credentials',
              client_id: clientId,
              client_secret: clientSecret,
              audience: `https://${appDomain}/api/v2/`,
            })
            .then(({ data: { access_token, token_type } }) =&gt; {
              const jwt = jwtDecode(access_token)
  
              axios
                .patch(`https://${appDomain}/api/v2/users/${userid}`, {
                  data: {
                    app_metadata: { stripeCustomerId: customer.id },
                  },
                  headers: {
                    Authorization: `${token_type} ${access_token}`,
                  },
                })
                .then(({ data }) =&gt; {
                  console.warn('patch response', data)
                })
                .catch((err) =&gt; {
                  console.error('patch error', err) // &lt;--- ERROR 401 happens here
                  res.send(err)
                })
            })
            .catch((err) =&gt; {
              console.error('token error', err)
              res.send(err)
            })
  </code></pre>