https://github.com/clerk/m2m-example
Example for how to create and verify m2m tokens with Clerk
https://github.com/clerk/m2m-example
Last synced: 12 months ago
JSON representation
Example for how to create and verify m2m tokens with Clerk
- Host: GitHub
- URL: https://github.com/clerk/m2m-example
- Owner: clerk
- Created: 2025-08-11T19:35:37.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-08-11T19:37:03.000Z (12 months ago)
- Last Synced: 2025-08-11T21:27:47.741Z (12 months ago)
- Language: TypeScript
- Size: 23.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Clerk M2M Tokens Example
A simple example of how to use M2M tokens with Clerk, using express.
### Running the example
- Head to the Clerk dashboard, to [machine config](https://dashboard.clerk.com/last-active?path=machines)
- Create two machines, called Machine A and Machine B. Make sure that the access scopes for Machine A include Machine B and vice versa. It should look [something like this](https://p176.p0.n0.cdn.zight.com/items/7KurL6Kx/ae284282-258e-43ea-8cb6-4a4ed1f87540.png?v=4eb6a0b199b0b3887c6c17b29e663c43).
- Create a `.env` file in the `/machine-a` and `/machine-b` folders in this repo with `cp machine-a/.env.sample machine-a/.env && cp machine-b/.env.sample machine-b/.env`
- Add the machine secrets from your Clerk dashboard into the `.env` files
- Run `npm start` to start the servers for machines A and B
- In your browser, open `http://localhost:3000/send` to trigger machine A to send a request to machine B. You should see a response with a verified token.