> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Import M2M clients from Auth0

> Migrating M2M clients from other platforms like Auth0 to Stytch.

Stytch's M2M Authentication supports importing clients from other platforms like Auth0. Use Stytch to import pre-existing `client_id`s, `client_secret`s, and assigned `scopes` without any data transformations or downtime.

## Before you start

In order to complete this guide, you'll need the following:

* A Stytch project. If you don't have one already, in the [Dashboard](https://stytch.com/dashboard), click on your existing project name in the top left corner of the Dashboard, click **Create Project**, and then select **Consumer Authentication**.
* The `project_id` and `secret` for the **Test environment** you would like to use. These values can be accessed from the **API keys** section of the Stytch Dashboard. You'll need to pass these values into the `Authorization` request header for most Stytch API calls.

## Importing M2M clients

**1. Access your existing client**

First, access your existing client wherever it is stored. For this guide, we'll use Auth0 as an example.

On Auth0 and under **Applications**, select an already created M2M client.

![Auth0 client](https://mintcdn.com/stytch-34ca0595/DwZBJa3bbAb4cQs6/images/consumer-auth/authentication/m2m/m2m-auth0-client.png?fit=max\&auto=format\&n=DwZBJa3bbAb4cQs6\&q=85\&s=663bd58a07f0aa87697e086db33b5afa)

You'll need to find and copy the client's values that correspond to the following Stytch M2M Client fields:

* `client_id`
* `client_secret`

**2. Import the client via API or the Dashboard UI**

In this guide, you'll use the Dashboard UI to do the import.

In the [Dashboard](https://stytch.com/dashboard), navigate to **M2M Clients** and then click the **Import** button. A popup modal will appear prompting you to enter the client ID and secret.

![Import client to Stytch](https://mintcdn.com/stytch-34ca0595/DwZBJa3bbAb4cQs6/images/consumer-auth/authentication/m2m/m2m-import-client.png?fit=max\&auto=format\&n=DwZBJa3bbAb4cQs6\&q=85\&s=5d4757b685cee999da48a70e12c6fbfb)

Enter the client's values you copied from **Step 1** and click **Import**.

**3. Add any additional metadata**

After the import, you can update the M2M Client with additional metadata like `client_name` and `client_description`.

![Edit M2M client](https://mintcdn.com/stytch-34ca0595/DwZBJa3bbAb4cQs6/images/consumer-auth/authentication/m2m/m2m-edit-client.png?fit=max\&auto=format\&n=DwZBJa3bbAb4cQs6\&q=85\&s=9f4cd15265ff8b9b7ad681a372cdbd43)

More importantly, you can transfer any previously defined scopes during this step. In Auth0, navigate to your client's permissions and record the scopes you want to transfer.

![Auth0 permissions](https://mintcdn.com/stytch-34ca0595/DwZBJa3bbAb4cQs6/images/consumer-auth/authentication/m2m/m2m-auth0-scopes.png?fit=max\&auto=format\&n=DwZBJa3bbAb4cQs6\&q=85\&s=0083a01f9a95c8c7a62ce0a7dc60907a)

Then in Stytch, scroll down to the **Scopes** section of the newly imported M2M Client and click **+ Add scopes**. A popup modal will appear prompting you to type in the scopes and separate them by a single space.

![Import scopes](https://mintcdn.com/stytch-34ca0595/DwZBJa3bbAb4cQs6/images/consumer-auth/authentication/m2m/m2m-import-scopes.png?fit=max\&auto=format\&n=DwZBJa3bbAb4cQs6\&q=85\&s=2e9d067763ff2807b5d8a2ed859d6fee)

Click **Save** when you've finished editing the M2M Client.

**4. Validate the access token's payload**

To confirm a successful import, issue an access token for the M2M Client and decode the JWT.

```javascript theme={null}
{
  "aud": [
    "${projectId}"
  ],
  "exp": 1693492107,
  "iat": 1693488507,
  "iss": "stytch.com/${projectId}",
  "nbf": 1693488507,
  "scope": "read:users update:users",
  "sub": "lJJsWpAmd42q0EEJHJoSAxTPzdgpzF0i"
}
```

The access token's payload and standard claims should show the following data:

* The `iss` and `sub` match or contain your `project_id`.
* The `scope` matches the scopes you entered in **Step 3**.
* The `sub` matches the `client_id` you imported from **Steps 1 and 2**.

If the criteria are met, your M2M Client has successfully been imported to Stytch.
