# Is the only way to obtain a Management API token via copy and paste?

**URL:** <https://community.auth0.com/t/is-the-only-way-to-obtain-a-management-api-token-via-copy-and-paste/86908>\
**Category:** Get Help\
**Tags:** jwt, api\
**Created:** [July 13, 2022, 2:45pm UTC](https://community.auth0.com/t/is-the-only-way-to-obtain-a-management-api-token-via-copy-and-paste/86908 "2022-07-13T14:45:40Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [July 14, 2022, 10:36pm UTC](https://community.auth0.com/t/is-the-only-way-to-obtain-a-management-api-token-via-copy-and-paste/86908/5 "2022-07-14T22:36:41Z")

</div>

No problem, happy to help where I can, and thanks for sharing your code!

I think you might be confusing the 2 different approaches a bit - In your `profile.js` I can see that you are using a `client_id` of a SPA app which isn’t going to work as you can’t use the `client_credentials` grant type because it is deemed a [public application](https://auth0.com/docs/get-started/applications/confidential-and-public-applications#public-applications). I think where you might be going wrong here is that you haven’t created or aren’t using a separate Machine to Machine (M2M) app to proxy the request to the management API for you.

It depends on what information you need from the Management API that dictates which approach to take - If you just need info about the current user then setting the audience to your Management API along with the requisite scopes on the client side and using this Access Token will work. Alternatively, if you need to get all users (you mentioned this initially) you will need to go the 2nd route which includes having your backend communicate via M2M/Client Credentials Exchange with the Auth0 Management API.

Here’s additional thread that goes in to detail explaining this:

> [@Access Management Api from React](https://community.auth0.com/t/access-management-api-from-react/71067/5):
>
> So, you mentioned you are calling a couple of endpoints: GET /api/v2/users/ No, this will not work. If you take a look at the table I included in my previous response and which is documented on [Get Management API Access Tokens for Single-Page Applications](https://auth0.com/docs/security/tokens/access-tokens/get-management-api-tokens-for-single-page-applications), you cannot call GET /api/v2/users/ with an Access Token that was issued from a SPA. It is not included in the table. Please note that GET /api/v2/users/ is not the same as GET /api/v2/users/{id}. GET /api/v2/users/{id} Now, this one sh…

This can be super confusing 😕 but hope this helps to further clarify!

---

_[View the full topic](https://community.auth0.com/t/is-the-only-way-to-obtain-a-management-api-token-via-copy-and-paste/86908)._
