# Api request failed 401

**URL:** <https://community.auth0.com/t/api-request-failed-401/131198>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [April 4, 2024, 9:27am UTC](https://community.auth0.com/t/api-request-failed-401/131198 "2024-04-04T09:27:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucas8](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lucas8/32/49896_2.png) [@lucas8](https://community.auth0.com/u/lucas8)\
**Post date:** [April 4, 2024, 9:27am UTC](https://community.auth0.com/t/api-request-failed-401/131198/1 "2024-04-04T09:27:53Z")

</div>

Please help. I create a api app and trying to create new user.  
I mangage to get access\_token. This token worked on api docs site but when I made a request in a backend of nextjs I got this error

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

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [April 4, 2024, 11:27pm UTC](https://community.auth0.com/t/api-request-failed-401/131198/3 "2024-04-04T23:27:19Z")

</div>

Hey @lucas8 welcome to the community!

Can you help me better understand your use case here? Are you attempting to create a user in Auth0 using the Management API from a nextjs backend?

The more detail you can provide the better, thanks!

---

<div class="post-metadata">

**Author:** ![lucas8](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lucas8/32/49896_2.png) [@lucas8](https://community.auth0.com/u/lucas8)\
**Post date:** [April 5, 2024, 3:05am UTC](https://community.auth0.com/t/api-request-failed-401/131198/4 "2024-04-05T03:05:43Z")

</div>

I missed spell a header hehe

---

<div class="post-metadata">

**Author:** ![lucas8](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lucas8/32/49896_2.png) [@lucas8](https://community.auth0.com/u/lucas8)\
**Post date:** [April 5, 2024, 3:07am UTC](https://community.auth0.com/t/api-request-failed-401/131198/5 "2024-04-05T03:07:37Z")

</div>

But I have another issue:  
When logout from a user, cookie appSession is deleted.  
Then reloading the app, previous appSession is auto added to cookie so you dont need to re login to user the app.  
Im expecting user have to login after logout to use the app

---

<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:** [April 19, 2024, 3:08am UTC](https://community.auth0.com/t/api-request-failed-401/131198/6 "2024-04-19T03:08:15Z")

</div>

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