Skip to main content

Authentication API Reference (MP)

This is a reference for authentication endpoint specifications, JWT claim structure, and error codes for Marketplace edition.

Authentication Endpoint List

Marketplace

Marketplace edition provides authentication endpoints that support the Client Credentials flow. Obtain an access token using service account credentials and use the API.

MethodEndpointDescription
POST/api/v1/auth/external-service-tokenToken endpoint. Issues an access token via the Client Credentials flow.
GET/.well-known/jwks.jsonJWKS endpoint. Returns the public key set for JWT signature verification.
Base URL

All endpoints use https://<your-domain> as the base URL. The domain can be found in the Marketplace admin panel.

Creating a Service Account

To use the API, create a service account in the admin panel and obtain the Client ID and Client Secret. Refer to the admin panel documentation for service account creation steps.

Token Endpoint

POST/api/v1/auth/external-service-token

Issues an access token via the Client Credentials flow. Authenticate using service account credentials (Client ID / Client Secret).

Request Headers

HeaderRequiredDescription
Content-TypeWhen using JSON bodyapplication/json (not required for Basic authentication)

Request Body

ParameterTypeRequiredDescription
client_idstringRequiredService account Client ID (issued in admin panel)
client_secretstringRequiredService account Client Secret (issued in admin panel)

Request Example

curl
curl -X POST https://<your-domain>/api/v1/auth/external-service-token \
-H "Content-Type: application/json" \
-d '{
"client_id": "your_client_id",
"client_secret": "your_client_secret"
}'

Response Fields (200 OK)

FieldTypeDescription
successbooleanRequest success (true on success)
access_tokenstringAccess token in JWT format
token_typestringBearer
expires_innumberAccess token expiration time (seconds)
scopestringGranted scopes (space-separated)

Response Example

JSON
{
"success": true,
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 1800,
"scope": "openid"
}
note

Marketplace edition does not issue refresh tokens. If the token expires, obtain a new token using the same procedure.

Error Response

StatusError CodeDescription
400missing_parametersclient_id or client_secret is missing
401auth_errorClient authentication failed (Client ID / Secret is incorrect)
500server_errorServer internal error
503network_errorCommunication with the authentication platform failed
JSON
{
"success": false,
"error": "Invalid credentials",
"message": "Invalid credentials",
"code": "auth_error"
}

JWKS Endpoint

GET/.well-known/jwks.json

Returns the JSON Web Key Set (JWKS) for JWT signature verification. Use this when verifying access token signatures.

Request Example

curl
curl https://<your-domain>/.well-known/jwks.json

Response Fields (200 OK)

FieldTypeDescription
keysarrayArray of JWK (JSON Web Key) objects
keys[].kidstringKey ID. Match against the kid in the JWT header to identify the verification key
keys[].ktystringKey type (e.g., "RSA")
keys[].algstringAlgorithm (e.g., "RS256")
keys[].usestringKey usage. "sig" (signature verification)
keys[].nstringRSA public key modulus (Base64url encoded)
keys[].estringRSA public key exponent (Base64url encoded)

Response Headers

HeaderDescription
Cache-Controlpublic, max-age=600

Response Example

JSON
{
"keys": [
{
"kid": "...",
"kty": "RSA",
"alg": "RS256",
"use": "sig",
"n": "...",
"e": "AQAB"
}
]
}
note

If key rotation occurs, the kid (Key ID) will change. When verifying signatures, use the key that matches the kid in the JWT header. Keys can be cached, but periodic re-fetching is recommended.

JWT Claims Structure

The structure of JWT claims (payload) contained in the access token. The signing algorithm is RS256.

Standard Claims

ClaimTypeDescription
substringService account ID (UUID)
issstringIssuer URL (e.g., https://<your-domain>/realms/<realm>)
audstringFixed value "account"
expnumberExpiration time (Unix timestamp)
iatnumberIssued at (Unix timestamp)
jtistringJWT ID. Unique identifier for the token
typstringToken type ("Bearer")
azpstringAuthorized Party (Client ID that requested the token)
scopestringGranted scopes (space-separated)
acrstringAuthentication Context Class

User Information

Internal identifiers auto-generated by the authentication platform when a service account is created. They do not represent a real user, so applications do not need to display or use them.

ClaimTypeDescription
emailstringInternal identifier assigned by the authentication platform
email_verifiedbooleanInternal flag assigned by the authentication platform (always true)
preferred_usernamestringInternal identifier assigned by the authentication platform

Service Account Information

ClaimTypeDescription
client_idstringClient ID
clientHoststringRequest source host
clientAddressstringRequest source IP address

Roles

Role information used for internal control by the authentication platform. Applications do not need to reference these roles.

ClaimTypeDescription
realm_access.rolesstring[]List of realm-level roles assigned by the authentication platform
resource_access.account.rolesstring[]List of client-level roles assigned by the authentication platform

JWT Access Token Payload Example

JSON
{
"exp": 1776713919,
"iat": 1776627519,
"jti": "trrtcc:abc12345-6789-4def-8abc-0123456789ab",
"iss": "https://<your-domain>/realms/<realm>",
"aud": "account",
"sub": "11111111-2222-3333-4444-555555555555",
"typ": "Bearer",
"azp": "my-service-account",
"acr": "1",
"realm_access": {
"roles": ["..."]
},
"resource_access": {
"account": {
"roles": ["..."]
}
},
"scope": "openid email profile",
"email_verified": true,
"clientHost": "192.168.1.100",
"preferred_username": "service-account-my-service-account",
"clientAddress": "192.168.1.100",
"email": "my-service-account@serviceaccount.local",
"client_id": "my-service-account"
}

Client Authentication

At the token endpoint, perform client authentication using one of the following methods.

JSON Body

Include client_id and client_secret as JSON in the request body.

JSON
{"client_id": "xxx", "client_secret": "yyy"}

Send via Basic authentication in the Authorization header. Request body is not required.

Authorization: Basic base64(client_id:client_secret)

Request Example with Basic Authentication

curl
curl -X POST https://<your-domain>/api/v1/auth/external-service-token \
-u "your_client_id:your_client_secret"

Error Codes

The authentication endpoint returns error responses in JSON format. All error responses include success: false.

Error Response Format

FieldTypeDescription
successbooleanAlways false
errorstringError message
messagestringError message (same as error)
codestringError code (for machine processing)
JSON
{
"success": false,
"error": "client_id and client_secret are required",
"message": "client_id and client_secret are required",
"code": "missing_parameters"
}

Error Code List

StatusError CodeDescription
400missing_parametersRequired parameters (client_id / client_secret) are missing
401auth_errorClient authentication failed (Client ID / Secret is incorrect)
500server_errorServer internal error
503network_errorCommunication with the authentication platform failed