# Connect API to SPA Application

**URL:** <https://community.auth0.com/t/connect-api-to-spa-application/63737>\
**Category:** Get Help\
**Tags:** spa, api\
**Created:** [June 2, 2021, 2:34pm UTC](https://community.auth0.com/t/connect-api-to-spa-application/63737 "2021-06-02T14:34:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![liam\_adams](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/liam_adams/32/12931_2.png) [@liam\_adams](https://community.auth0.com/u/liam_adams)\
**Post date:** [June 2, 2021, 2:34pm UTC](https://community.auth0.com/t/connect-api-to-spa-application/63737/1 "2021-06-02T14:34:40Z")

</div>

I have a System Management API with all scopes with an audience [https://audience/api/v2](https://audience/api/v2) that has the scopes. I also have an SPA with clientId and clientSecret. I want to use this API (or any API) to add/delete users in my SPA. However i don’t see an API tab on my SPA or any way to link the API to my SPA.

When I make a request like [https://audience/api/v2/users/auth0|dskjfdksfn](https://audience/api/v2/users/auth0%7Cdskjfdksfn) using the bearer token from my SPA clientId and Secret i get a 403. How can I use an API to manage my SPA?

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [June 3, 2021, 4:56pm UTC](https://community.auth0.com/t/connect-api-to-spa-application/63737/3 "2021-06-03T16:56:46Z")

</div>

Hi @liam_adams,

Thanks for joining the Community!

The Management API can only be used for a limited number of things from a SPA such as updating user metadata:

> **[Get Management API Access Tokens for Single-Page Applications](https://auth0.com/docs/secure/tokens/access-tokens/get-management-api-tokens-for-single-page-applications)**
>
> Learn about available scopes and endpoints for Management API tokens for Single-page Applications (SPAs).

Creating and deleting users directly from a SPA is not allowed, but you can do such things from your own custom API by creating a Machine-to-Machine application:

> **[Register Machine-to-Machine Applications](https://auth0.com/docs/get-started/auth0-overview/create-applications/machine-to-machine-apps)**
>
> Learn how to register and configure a machine-to-machine (M2M) application using the Auth0 Dashboard and authorize it using the Management API test feature.

You can authorize the Machine-to-Machine app to use the Management API with the specific scopes you require. You can then register your API as a custom API and use its identifier in the SPA:

> **[Register APIs](https://auth0.com/docs/get-started/auth0-overview/set-up-apis)**
>
> Learn how to register APIs in the Auth0 Dashboard.

Here are the docs for using the management API in production:

> **[Get Management API Access Tokens for Production](https://auth0.com/docs/secure/tokens/access-tokens/get-management-api-access-tokens-for-production)**
>
> Learn how to get Access Tokens to make scheduled frequent calls to the Management API.

---

<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:** [June 25, 2021, 1:03pm UTC](https://community.auth0.com/t/connect-api-to-spa-application/63737/4 "2021-06-25T13:03:20Z")

</div>

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