# Auth0 Forms Update User 401 error

**URL:** <https://community.auth0.com/t/auth0-forms-update-user-401-error/150709>\
**Category:** Get Help\
**Tags:** connections-management-api, management-api\
**Created:** [October 30, 2024, 9:34am UTC](https://community.auth0.com/t/auth0-forms-update-user-401-error/150709 "2024-10-30T09:34:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joao.magalhaes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/joao.magalhaes/32/51486_2.png) [@joao.magalhaes](https://community.auth0.com/u/joao.magalhaes)\
**Post date:** [October 30, 2024, 9:34am UTC](https://community.auth0.com/t/auth0-forms-update-user-401-error/150709/1 "2024-10-30T09:34:51Z")

</div>

I have setup an Auth0 Form for a OTP verification email flow.

I created the following:

1. M2M Application with Auth0 Management API permission for read/write users, app\_user\_metadata.
2. In Auth0 Forms \> Vault: I created the connection for Auth0 with the M2M application data (tenant, client id, client secret)
3. Connection to Auth0 is successful

The flow is working and everything is a success, when the otp code is confirmed and verified the next step is to update the user metadata, however that specific request is failing due to an invalid bearer token.

Below are the screen shots of the implementation:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/e/2/e224edece6479234ea20e58c6c8277b4767dc71f.png)

 ![image](https://global.discourse-cdn.com/auth0/original/3X/f/c/fc2203c90807766484f4f0ab12bdbd6c11cba4dd.png)

 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/1/1107517f3c018e1e2631c363c812f728171bd198.png)

 ![image](https://global.discourse-cdn.com/auth0/original/3X/4/6/4690173ecc433beb351df16b6d3f3e34768361fd.jpeg)

---

<div class="post-metadata">

**Author:** ![sam.karl](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sam.karl/32/60022_2.png) [@sam.karl](https://community.auth0.com/u/sam.karl)\
**Post date:** [January 16, 2025, 12:20am UTC](https://community.auth0.com/t/auth0-forms-update-user-401-error/150709/3 "2025-01-16T00:20:08Z")

</div>

Did you resolve this? Having same issue.

---

<div class="post-metadata">

**Author:** ![sam.karl](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sam.karl/32/60022_2.png) [@sam.karl](https://community.auth0.com/u/sam.karl)\
**Post date:** [January 16, 2025, 12:40am UTC](https://community.auth0.com/t/auth0-forms-update-user-401-error/150709/4 "2025-01-16T00:40:26Z")

</div>

Hello All, I resolved the issue. I found an amazing help article that took a while to find. I was using a SPA application and not a M2M. After changing to M2M it worked perfect!

developer.auth0.c0m

resources/labs/forms/user-onboarding-made-easy#create-a-flow-to-update-user-metadata

---

<div class="post-metadata">

**Author:** ![gerald.czifra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gerald.czifra/32/75301_2.png) [@gerald.czifra](https://community.auth0.com/u/gerald.czifra)\
**Post date:** [January 16, 2025, 6:17pm UTC](https://community.auth0.com/t/auth0-forms-update-user-401-error/150709/5 "2025-01-16T18:17:26Z")

</div>

Hi @sam.karl

Thank you for sharing that, great to hear that it’s now working for you!

@joao.magalhaes Please let me know if you had a moment to check the [documentation](https://developer.auth0.com/resources/labs/forms/user-onboarding-made-easy#introduction) provided by Sam and if it helped with your current error, I’ve linked it to make things easier.

One thing I noticed is that you might require `create:users_app_metadata` permission enabled as well in order to properly add " email\_verified : True " to the user’s app\_metadata. Usually to update the email\_verified attribute, you would only need update:users and use the `user.email_verified` property under the **user** body, but since you wish to add this to their app\_metadata, you would also need the permission to create it.

It might prove useful to have this other documentation handy as well on [variables and functions](https://auth0.com/docs/customize/forms/variables) within Forms.

Hope this helped!  
Gerald

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 30, 2025, 6:17pm UTC](https://community.auth0.com/t/auth0-forms-update-user-401-error/150709/6 "2025-01-30T18:17:52Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
