M2M authentication flow
Create an M2M client
Create an M2M client to get credentials for authentication using the Create M2M Client endpoint:Response:Store the
client_id and client_secret securely - the secret is only returned once at creation.Get an access token
Use the client credentials to obtain an access token using the Get Access Token endpoint:Response:Access tokens are JWTs signed with your project’s JWKS and are valid for one hour.
Use the access token
Include the access token in API requests:Validate tokens using the Authenticate Access Token method in the Stytch Backend SDKs or any JWT validation library.
Managing M2M clients
- Update Client
- Search Clients
- Delete Client
Update client settings like name, description, or scopes using the Update M2M Client endpoint:Updating scopes affects future access tokens but doesn’t invalidate existing ones.
Access token claims
M2M access tokens are JWTs containing standard claims:sub: The M2M client IDscope: Space-separated list of granted scopesexp: Token expiration (1 hour from issuance)
Learn more
M2M Client object
M2M Client object reference
Get JWKS
Retrieve public keys for token validation