Skip to main content

Authentication Reference (Marketplace)

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

Marketplace Authentication Endpoint List

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 access token via Client Credentials flow.
GET/.well-known/jwks.jsonJWKS endpoint. Returns JSON Web 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

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

Request Headers

HeaderRequiredDescription
Content-TypeRequiredapplication/json

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

StatuscodeDescription
400missing_parametersclient_id or client_secret is missing
401invalid_credentialsClient authentication failed (Client ID / Secret is incorrect)
500server_errorServer internal error

Error Response Example

JSON
{
"success": false,
"error": "Authentication information is incorrect",
"message": "Authentication information is incorrect",
"code": "invalid_credentials"
}

JWKS Endpoint

GET /.well-known/jwks.json

Return a JSON Web Key Set (JWKS) for JWT signature verification. Use this to verify access token signatures.

Request Example

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

Response Headers

HeaderDescription
Cache-Controlpublic, max-age=3600

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. Claims are output in flat structure.

Standard Claims

ClaimTypeDescription
substringService account ID (UUID)
issstringIssuer URL
audstringAudience (Client ID)
expnumberExpiration time (Unix timestamp)
iatnumberIssued at (Unix timestamp)
azpstringAuthorized Party (Client ID that requested the token)
scopestringGranted scopes (space-separated)
acrstringAuthentication Context Class

User Information

ClaimTypeDescription
emailstringService account email address
email_verifiedbooleanWhether email address is verified
preferred_usernamestringUsername

Profile (Optional)

Only output if user attributes are set for the service account in the admin panel.

ClaimTypeDescription
organizationstringOrganization
jobstringJob title
biostringBio

Service Account Information

ClaimTypeDescription
client_idstringClient ID
clientHoststringRequest source host
clientAddressstringRequest source IP address

Roles

ClaimTypeDescription
realm_access.rolesstring[]Assigned roles (e.g., user)

JWT Access Token Payload Example

JSON
{
"sub": "7c6f8a3c-2e1b-4d9f-a5e2-1b4c8d3f2e1a",
"iss": "https://your-domain/auth",
"aud": "account",
"exp": 1678886400,
"iat": 1678884600,
"azp": "my-service-account",
"acr": "1",
"scope": "openid email profile",
"email": "service@example.com",
"email_verified": true,
"preferred_username": "service-account-my-service",
"client_id": "my-service-account",
"clientHost": "192.168.1.100",
"clientAddress": "192.168.1.100",
"realm_access": {
"roles": ["user"]
}
}

Client Authentication

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

JSON Body

Include client_id and client_secret in 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

codeStatusDescription
missing_parameters400Required parameters (client_id / client_secret) are missing
invalid_credentials401Client authentication failed (Client ID / Secret is incorrect)
rate_limit_exceeded429Request rate limit exceeded
server_error500Server internal error