Machine Authentication

This guide explains how machine authentication works using Wristband.

How Machine Authentication Works

Wristband uses the OAuth OAuth 2.1 Client Credentials Flow to authenticate machines, such as backend services and automated processes, without requiring user interaction.

To authenticate, a machine sends a request to Wristband's Token Endpoint using the client_credentials grant type. The machine authenticates by providing its client ID and client secret in the Authorization header using HTTP Basic authentication.

If authentication succeeds, Wristband returns an access token that the machine can use to make authenticated API requests. Refresh tokens are not issued as part of this flow because the machine can request a new access token using its client credentials whenever the current token expires.

The following diagram illustrates the high-level interactions between a machine and Wristband during the Client Credentials Flow.


sequenceDiagram
    participant Machine as Your Machine
    participant Wristband as Wristband
    participant API as Protected API

    Machine->>Wristband: Request access token (client_credentials)
    Note right of Machine: Authenticate using client ID and secret
    Wristband-->>Machine: Return access token
    Machine->>API: API request with access token
    API-->>Machine: API response

Client Registration

Before a machine can authenticate using the client_credentials grant type, a Machine-to-Machine (M2M) client must be registered in Wristband. During registration, the client is issued a client ID and client secret, which the machine uses to authenticate with Wristband's Token Endpoint.

M2M clients can be registered at either the application level or tenant level, depending on who owns and operates the machine:

  • Application-Level M2M Clients: Used for first-party machines owned and operated by your application. These clients are registered at the application level. For configuration details, see the Managing Application Clients documentation
  • Tenant-Level M2M Clients: Used for third-party machines owned or operated by your customers. These clients are registered under the customer's tenant. For configuration details, see the Manage Tenant Clients documentation.

Programmatic Client Registration

In addition to registering M2M clients through the Wristband Dashboard, you can register them programmatically using the Create Client API.

Access Token Caching

After retrieving an access token from the Wristband Token Endpoint, your application should cache the token locally and reuse it for subsequent API requests until it expires. This reduces unnecessary calls to the Token Endpoint, improving application performance and reducing network overhead.

When the cached token expires, your application should request a new access token and update the cache.

Machine-to-Machine Authentication SDKs

Wristband provides SDKs in multiple programming languages that simplify Machine-to-Machine (M2M) authentication using the OAuth 2.1 client_credentials grant type.

See our M2M Authentication SDKs for a list of available SDKs and integration resources.


Did this page help you?