# "Sandbox Error: Not authorized" on email change

**URL:** <https://community.auth0.com/t/sandbox-error-not-authorized-on-email-change/108571>\
**Category:** Get Help\
**Tags:** emails, management-api\
**Created:** [June 5, 2023, 4:03pm UTC](https://community.auth0.com/t/sandbox-error-not-authorized-on-email-change/108571 "2023-06-05T16:03:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimo.petkov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dimo.petkov/32/47807_2.png) [@dimo.petkov](https://community.auth0.com/u/dimo.petkov)\
**Post date:** [June 5, 2023, 4:03pm UTC](https://community.auth0.com/t/sandbox-error-not-authorized-on-email-change/108571/1 "2023-06-05T16:03:23Z")

</div>

Hi All,

I am trying to update user email via the Management API, but I get error code 400 with `"Sandbox Error: Not authorized"` response.

I first get the token with `"update:users"` scope:

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

Then I use it to update user:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/d/6/d691022942609f8afe75d192fc4c6c8732bbbd00.png)

Note that if I use the same request but for password instead of email it works:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/6/5/65439e85899a84c6f131c639483c9f768d69c0c2.png)

I am not sure what I am missing the Management API has the following scopes enabled for the application:

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

Can someone help?

**Edit:**  
I also get the same error when I try to change the email via the Dashboard:  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/b/7/b7617528b4c6b88509726710c8bea26ccac8fdb9.png)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 16, 2023, 12:55pm UTC](https://community.auth0.com/t/sandbox-error-not-authorized-on-email-change/108571/3 "2023-06-16T12:55:58Z")

</div>

Hi @dimo.petkov,

Welcome to the Auth0 Community!

Are you using a custom database connection?

---

<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:** [July 20, 2023, 3:34pm UTC](https://community.auth0.com/t/sandbox-error-not-authorized-on-email-change/108571/4 "2023-07-20T15:34:33Z")

</div>

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