# Unsure when to use machine 2 machine application or API

**URL:** <https://community.auth0.com/t/unsure-when-to-use-machine-2-machine-application-or-api/121653>\
**Category:** Get Help\
**Tags:** connections-management-api, management-api\
**Created:** [November 26, 2023, 3:19pm UTC](https://community.auth0.com/t/unsure-when-to-use-machine-2-machine-application-or-api/121653 "2023-11-26T15:19:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kada](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kada/32/52736_2.png) [@Kada](https://community.auth0.com/u/Kada)\
**Post date:** [November 26, 2023, 3:19pm UTC](https://community.auth0.com/t/unsure-when-to-use-machine-2-machine-application-or-api/121653/1 "2023-11-26T15:19:36Z")

</div>

Hey there,

I’m a bit confused by the difference between machine 2 machine application and API in Auth0

I have a NextJS frontend and a Golang monolith backend

So far, I’ve created one SPA Application in Auth0 for the frontend, and one Auth0 API for the backend, and I’m using the corresponding client ID/audience as environment variables for both

Right now, I’m implementing new methods in the backend that use the Auth0 Management API with auth0/go-auth0

But for this to work, I need a Client Secret, which is not available for an Auth0 API:

```go
	auth0API, err := management.New(
		.Auth0_domain,
		management.WithClientCredentials(
			context.TODO(),
			Auth0_client_id,
			Auth0_client_secret,
		),
	)

```

Did I miss something ? Should I use an M2M App for my backend instead of an Auth0 API?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [November 28, 2023, 12:14am UTC](https://community.auth0.com/t/unsure-when-to-use-machine-2-machine-application-or-api/121653/3 "2023-11-28T00:14:52Z")

</div>

Hi @Kada,

Welcome to the Auth0 Community!

The M2M app is used to access your API through the Client Credentials flow. You will need to configure both to call your API.

See the documentation below:  
[https://auth0.com/docs/authorization/flows/call-your-api-using-the-client-credentials-flow](https://auth0.com/docs/authorization/flows/call-your-api-using-the-client-credentials-flow)

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![Kada](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kada/32/52736_2.png) [@Kada](https://community.auth0.com/u/Kada)\
**Post date:** [November 28, 2023, 9:51am UTC](https://community.auth0.com/t/unsure-when-to-use-machine-2-machine-application-or-api/121653/4 "2023-11-28T09:51:59Z")

</div>

That’s what I end up doing, thank you !

---

<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:** [December 12, 2023, 9:52am UTC](https://community.auth0.com/t/unsure-when-to-use-machine-2-machine-application-or-api/121653/5 "2023-12-12T09:52:59Z")

</div>

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