# M2M OAuth Clients

{% hint style="info" %}
Machine-to-machine authentication (using M2M OAuth Clients) is only available for organizations on an Enterprise Large plan or superior. If you want to upgrade or have any questions, please contact us at [support@carto.com](mailto://support@carto.com).
{% endhint %}

All developer credentials can be created, edited, and managed in the Developers > Credentials section in CARTO Workspace. One of the most common developer credential types in CARTO is **M2M OAuth Clients,** which are managed in this tab.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2FsXgIrSaXn4KOBA65YjzU%2FScreenshot%202024-04-29%20at%2016.36.43.png?alt=media&#x26;token=8838b877-3a8d-4470-b9ea-24a95d99a433" alt=""><figcaption></figcaption></figure>

## What are M2M OAuth Clients?

M2M OAuth Client stands for **Machine-to-machine OAuth Client.** It's a developer credential that lets you build authentication without requiring any user input. This is useful in scenarios where there's no human end user (such a backend-only application) or when integrating CARTO in existing applications that do not use CARTO credentials. Using your M2M OAuth Client, your application can request an [OAuth Access Token](../../../carto-for-developers/key-concepts/authentication-methods/oauth-access-tokens) on demand.

This OAuth Access Token has the same permissions as the owner of the M2M OAuth Client, and can be used to make any API requests as that user, such as loading maps, queries, or running workflows.

A common strategy for granular, robust authentication is to use the obtained OAuth Access Token to programmatically (server-side) generate API Access Tokens with specific data grants using the Tokens API. These API Access Tokens can then be used by the final application client-side.

{% hint style="info" %}
**Guides for developers**

* You can find a step-by-step guide to [integrating CARTO in your existing application](../../../carto-for-developers/guides/integrate-carto-in-your-existing-application) using a M2M OAuth Client in the CARTO for Developers documentation.
{% endhint %}

## Managing your M2M OAuth Clients

After you create your first M2M OAuth Client, you will be able to view the list of existing clients for your own user. M2M OAuth Clients created by other users aren't shown in this list.

### Creating a new M2M OAuth Client

Click on "Create new > M2M OAuth Client" to get started. You'll only need to provide:

* **Name:** This is a purely informative name. It will be used to identify this M2M OAuth Client in other lists.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2FgdZVln8nIOPXsQz02CMc%2FScreenshot%202024-04-29%20at%2016.38.10.png?alt=media&#x26;token=c3a942d6-beaf-4cfe-b4be-82dc6e962b8b" alt=""><figcaption></figcaption></figure>

### Using your new M2M OAuth Client

To use your new M2M OAuth Client in an application, you'll need both the Client ID and the Client Secret:

* **Client ID:** this is the unique identifier — the public key for this OAuth client. This can be copied directly from the list of credentials.
* **Client Secret:** this is a secret key. Anyone with access to this Client Secret and the Client ID can use this OAuth client.

Both values can be obtained after clicking the "View or edit credential" button in the contextual menu.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fw5HotJKO9b3hje5RASv2%2FScreenshot%202024-04-29%20at%2016.39.45.png?alt=media&#x26;token=f53652bc-237b-402e-952e-11603a6fca23" alt=""><figcaption></figcaption></figure>

Once you view or edit an existing M2M OAuth Client, the Client ID and Client Secret will be available to copy. The Client Secret will be masked in the screen by default to minimize risks.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2FBA6riT4YGF1Qryz0qanI%2FScreenshot%202024-04-29%20at%2016.41.08.png?alt=media&#x26;token=20a8210e-029f-46b0-991e-19e03104c4d1" alt=""><figcaption></figcaption></figure>

You can also make any desired changes to the M2M OAuth Client name.

If in the previous step, you choose to "Delete" your M2M OAuth Client, you'll be warned about this action and asked to confirm.

{% hint style="danger" %}
Do not share the Client ID and Client Secret of your OAuth clients and store them securely. Anyone can impersonate your application with that information.
{% endhint %}

{% hint style="success" %}
When you delete a M2M OAuth Client, all services trying to use it will stop working. If this happens accidentally, just recreate the client from scratch, and change the _Client ID_ and _Client Secret_ in the app's code.
{% endhint %}
