Enable secure, automated authorization for your backend systems, microservices, and IoT devices, ensuring only trusted apps and devices can access your APIs.
What Are M2M Applications?
Machine-to-machine (M2M) applications enable backend services, CLIs, scheduled jobs, and smart devices to obtain access tokens and interact with APIs using dedicated credentials. Instead of human user authentication, these apps use their own credentials to securely access resources, streamlining automation and integration across your stack.
Common Use Cases
Application Backends: Facilitates secure transfer of data, files, or logs between microservices or external systems.
CLI Tools: Allows tools running on developer or deployment machines to access APIs with short-lived tokens.
Scheduled Jobs & Daemons: Empowers background tasks (e.g., cronjobs, queuing systems) to access protected resources safely.
IoT Devices: Enables each smart device to authenticate independently and send data securely to cloud APIs.
Set Up M2M Applications in Authgear
1. Register Your API Resources
Go to the API Resources page in the Authgear portal:
Create the API resource your apps/devices will access.
When registering the resource, specify its identifier—this acts as the unique URI representing your API (for example, https://myapi.com/api).
This identifier will be set as the aud (audience) claim in the JWT access tokens issued for this resource.
Define scopes for granular permissions, such as read:data, write:data, or manage:config.
Scopes specify exactly what operations clients can perform on your API.
2. Register Your Application
In the Applications page:
Create a client application for each backend service, CLI tool, job, or device that needs API access.
Assign the relevant API resources and scopes to the application, ensuring least-privilege access.
After creating the application, you’ll be able to view its Client ID and Client Secret in the portal. Keep the Client Secret secure. It should never be exposed in client-side code or public repositories.
3. Request a Token Using the Client Credentials Flow