/{app_slug}/v1/oauth/tokenExchange client_credentials for an access token
Standard OAuth 2.0 client_credentials grant. Returns an app-scoped access token whose `scopes[]` claim is the union of the client's configured scopes. Use for service-to-service calls.
Path parameters
app_slug*stringSlug of the app.
Request body
grant_type*stringOAuth grant type. Only 'client_credentials' is supported.
Example: "client_credentials"
client_id*stringM2M client identifier (m2m_*).
Example: "m2m_a1b2c3d4e5f6..."
client_secret*stringM2M client secret (issued at client creation, never returned again).
Example: "the-secret-returned-by-credentials-create"
Response · 200 An app-scoped M2M access token and its granted scopes.
access_token*stringAccess token (RS256 JWT signed with the app JWKS key).
token_type*stringAlways `Bearer`.
Example: "Bearer"
expires_in*numberAccess-token lifetime in seconds.
Example: 3600
scope*stringSpace-separated scopes, RFC 6749.
Example: "user.read user.list"
Example
Request
POST https://api.auth.productcraft.co/{app_slug}/v1/oauth/token
Content-Type: application/json
{
"grant_type": "client_credentials",
"client_id": "m2m_a1b2c3d4e5f6...",
"client_secret": "the-secret-returned-by-credentials-create"
}Response
{
"access_token": "string",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "user.read user.list"
}