Skip to content
  • Machine-to-Machine (M2M)
  • Automation

Trigger workflows when an M2M token is generated

Kinde lets you run your own code via the M2M token generation workflow whenever a machine-to-machine (M2M) token is generated. This gives you a powerful way to react to token usage in real time.

Use this to:

  • Audit or log token usage
  • Apply custom validation
  • Configure downstream services dynamically
  • Enforce limits or rate-based rules

This trigger runs server-side on Kinde infrastructure. You don’t need to deploy or host anything yourself.

Real-world use cases

Link to this section

Here are some examples of how teams are using this workflow trigger:

1. Track token usage by region

Link to this section

Log a metric to your analytics system based on metadata in the token (e.g. region: eu). Helps track activity across territories.

2. Enforce internal token policies

Link to this section

Prevent token generation if a certain property or flag is missing (e.g. model_version not assigned).

3. Apply dynamic configuration

Link to this section

Trigger a downstream webhook or set a cache flag when a token is generated, allowing dependent services to fetch relevant settings.

4. Alert on suspicious usage

Link to this section

Send an alert or log entry if a token is requested more than X times within a short period.

Set up the M2M token generation workflow

Link to this section

The full setup process and code example is documented in the Token generated workflow trigger page, and includes:

  • Example JavaScript handler
  • Event payload shape
  • Deployment instructions