# Bad audience when changing user\_metadata

**URL:** <https://community.auth0.com/t/bad-audience-when-changing-user-metadata/10801>\
**Category:** JWT.io\
**Created:** [April 11, 2018, 5:22pm UTC](https://community.auth0.com/t/bad-audience-when-changing-user-metadata/10801 "2018-04-11T17:22:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephen.jensen.ihi](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@stephen.jensen.ihi](https://community.auth0.com/u/stephen.jensen.ihi)\
**Post date:** [April 11, 2018, 5:22pm UTC](https://community.auth0.com/t/bad-audience-when-changing-user-metadata/10801/1 "2018-04-11T17:22:24Z")

</div>

I’m wondering if someone can clarify the correct workflow for changing an email or app\_metadata property in a user’s auth0 account. I have jwt working between express and a react app for login. I’d like to use the auth0 api v2 to edit a user’s app\_metadata. When I send a PATCH request off, I get a 401 `bad audience` error. This kind of makes sense to me because the audience of my jwt for authenticating between the client and my backend is likely different from what I need to communicate with the auth0 api.

This is basically what it looks like clientside, but I’ve also tried it on the server with the same result.

```
axios.defaults.headers.Authorization = `Bearer ${localStorage.getItem('access_token')}`;
axios
  .get('https://xxx.auth0.com/api/v2/users/58c6db003c9c2b7caff55ebc', { user_metadata: { firstName: 's', lastName: 'j' } })
  .then(response => console.log(response));

```

How exactly do I get an updated access\_token that I can use to change an auth0 property? Is it easier to send off the command from the client, or can I just give my backend full access to change app\_metadata and then just ensure that I do enforcement before sending the command off? What does the axios code look like for a server-side PATCH call?

Thanks!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 18, 2018, 5:00pm UTC](https://community.auth0.com/t/bad-audience-when-changing-user-metadata/10801/3 "2018-12-18T17:00:27Z")

</div>

Hey @stephen.jensen.ihi !

As it has been more than a few months since this topic was opened and there has been no reply or further information provided from the community as to the existence of the issue we would like to check if you are still facing the described challenge?

We are more than happy to assist in any way! If the issue is still out there please let us know so we can create a new thread for better visibility, otherwise we’ll close this one in week’s time.

Thank you!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 24, 2018, 5:00pm UTC](https://community.auth0.com/t/bad-audience-when-changing-user-metadata/10801/4 "2018-12-24T17:00:05Z")

</div>

This topic was automatically closed after 6 days. New replies are no longer allowed.
