Skip to main content

Authentication Reference (SaaS)

This is a reference for OIDC endpoint specifications, JWT claim structures, scopes, and error codes for AgenticStar SaaS edition.

Endpoint List

MethodEndpointDescription
GET/.well-known/openid-configurationOpenID Connect Discovery endpoint
GET/auth/v1/authorizeAuthorization Code flow user authorization endpoint
POST/auth/v1/tokenToken acquisition endpoint (supports AC / CC / Refresh Token flows)
GET/auth/v1/userinfoUser information retrieval endpoint
GET/auth/v1/jwksJSON Web Key Set (JWKS) endpoint
POST/auth/v1/revokeToken revocation endpoint
GET/auth/v1/logoutLogout endpoint

Base URL: https://auth.agenticstar.jp/federation

Issuer: https://auth.agenticstar.jp/realms/federation

Discovery

GET /.well-known/openid-configuration

OpenID Connect Discovery endpoint. Clients retrieve endpoint URLs and server information.

Request Example

curl
curl https://auth.agenticstar.jp/federation/.well-known/openid-configuration

Response Example

JSON
{
"issuer": "https://auth.agenticstar.jp/realms/federation",
"authorization_endpoint": "https://auth.agenticstar.jp/federation/auth/v1/authorize",
"token_endpoint": "https://auth.agenticstar.jp/federation/auth/v1/token",
"userinfo_endpoint": "https://auth.agenticstar.jp/federation/auth/v1/userinfo",
"jwks_uri": "https://auth.agenticstar.jp/federation/auth/v1/jwks",
"revocation_endpoint": "https://auth.agenticstar.jp/federation/auth/v1/revoke",
"end_session_endpoint": "https://auth.agenticstar.jp/federation/auth/v1/logout",
"grant_types_supported": ["authorization_code", "refresh_token", "client_credentials"],
"response_types_supported": ["code"],
"response_modes_supported": ["query"],
"subject_types_supported": ["public"],
"id_token_signing_alg_values_supported": ["RS256"],
"token_endpoint_auth_methods_supported": ["client_secret_basic", "client_secret_post"],
"code_challenge_methods_supported": ["S256"]
}

Authorization Code Flow

GET /auth/v1/authorize

User authenticates and authorizes the application to obtain an Authorization Code. Access directly via web browser.

Query Parameters

ParameterTypeRequiredDescription
client_idstringRequiredClient ID
redirect_uristringRequiredURI to redirect to after authorization (pre-registration required)
response_typestringRequiredSpecify code
scopestringRequiredSpace-separated scopes. openid is required
statestringRequiredFor CSRF protection. Unpredictable value generated by client
noncestringFor nonce claim insertion into ID Token (recommended)
kc_idp_hintstringTenant ID hint. Can skip login screen

Request URL Example

curl
https://auth.agenticstar.jp/federation/auth/v1/authorize?\
client_id=my-client&\
redirect_uri=https%3A%2F%2Fapp.example.com%2Fcallback&\
response_type=code&\
scope=openid%20chat%3Aall&\
state=abc123xyz&\
nonce=xyz789abc

On Success

If user authorization is successful, redirection occurs in the following format:

https://app.example.com/callback?\
code=AUTH_CODE&\
state=abc123xyz

On Error

If an error occurs, redirection occurs in the following format:

https://app.example.com/callback?\
error=invalid_scope&\
error_description=...&\
state=abc123xyz
Error CodeDescription
invalid_requestRequired parameters missing or format is invalid
unauthorized_clientClient is not authorized to use authorization flow
invalid_scopeRequested scope is invalid or missing
server_errorServer-side error

Token Endpoint

POST /auth/v1/token

Obtain an access token (and ID Token) using Authorization Code or Client Credentials flow.

Request Headers

HeaderRequiredDescription
Content-TypeRequiredapplication/x-www-form-urlencoded

Authorization Code Flow

Request Body

ParameterTypeRequiredDescription
grant_typestringRequiredSpecify authorization_code
codestringRequiredAuthorization code obtained from Authorization Code endpoint
redirect_uristringRequiredSame value as redirect_uri specified when requesting Authorization Code
client_idstringRequiredClient ID
client_secretstringRequiredClient Secret (transmit securely over backend communication)

Request Example

curl
curl -X POST https://auth.agenticstar.jp/federation/auth/v1/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=authorization_code" \
-d "code=AUTH_CODE" \
-d "redirect_uri=https://app.example.com/callback" \
-d "client_id=my-client" \
-d "client_secret=my-secret"

Client Credentials Flow

Request Body

ParameterTypeRequiredDescription
grant_typestringRequiredSpecify client_credentials
client_idstringRequiredClient ID
client_secretstringRequiredClient Secret

If the service account feature is enabled, tenant information associated with the client is included in the token.

Request Example

curl
curl -X POST https://auth.agenticstar.jp/federation/auth/v1/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=my-client" \
-d "client_secret=my-secret"

On Success (200 OK)

JSON
{
"access_token": "eyJhbGciOiJSUzI1NiIs...",
"id_token": "eyJhbGciOiJSUzI1NiIs...",
"expires_in": 3600,
"refresh_expires_in": 86400,
"refresh_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "Bearer",
"scope": "openid chat:all"
}

Error Response

StatusError CodeDescription
400invalid_requestRequired parameters missing or format is invalid
401invalid_clientClient authentication failed (ID / Secret is incorrect)
400invalid_grantAuthorization Code is invalid or expired
400invalid_scopeRequested scope is invalid

Refresh Token

POST /auth/v1/token (refresh_token grant)

Refresh an access token using a Refresh Token.

Request Body

ParameterTypeRequiredDescription
grant_typestringRequiredSpecify refresh_token
refresh_tokenstringRequiredRefresh Token obtained from Token endpoint
client_idstringRequiredClient ID
client_secretstringRequiredClient Secret

Request Example

curl
curl -X POST https://auth.agenticstar.jp/federation/auth/v1/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token" \
-d "refresh_token=REFRESH_TOKEN" \
-d "client_id=my-client" \
-d "client_secret=my-secret"

Response Example

JSON
{
"access_token": "eyJhbGciOiJSUzI1NiIs...",
"id_token": "eyJhbGciOiJSUzI1NiIs...",
"expires_in": 3600,
"refresh_expires_in": 86400,
"refresh_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "Bearer",
"scope": "openid chat:all"
}

UserInfo

GET /auth/v1/userinfo

Retrieve user information using a valid access token. For tenant-based authentication, the idp block contains IdP user information in addition to OIDC standard claims.

Request Headers

HeaderRequiredDescription
AuthorizationRequiredBearer <access_token>

Request Example

curl
curl https://auth.agenticstar.jp/federation/auth/v1/userinfo \
-H "Authorization: Bearer <access_token>"

Response Fields

FieldTypeDescription
substringUser ID (OIDC standard)
idpobjectUser information retrieved from IdP (only when via tenant)
idp.substringUser ID on IdP side
idp.namestringDisplay name
idp.preferred_usernamestringUsername (email address)
idp.emailstringEmail address
idp.email_verifiedbooleanWhether email address is verified
idp.organizationobjectOrganization (includes id and label)
idp.jobobjectJob title (includes id and label)
idp.biostringBio

Response Example

JSON
{
"sub": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"idp": {
"sub": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "yamada_taro",
"preferred_username": "taro.yamada@example.com",
"email": "taro.yamada@example.com",
"email_verified": true,
"organization": {
"id": "org-001",
"label": "Example Corp."
},
"job": {
"id": "job-001",
"label": "Engineer"
},
"bio": "Software engineer"
}
}

Error Response

StatusError CodeDescription
401invalid_tokenToken is invalid or expired
502bad_gatewayFailed to retrieve user information from IdP

JWKS

GET /auth/v1/jwks

Retrieve a JSON Web Key Set (JWKS) for JWT signature verification. Use this to verify the signatures of ID Tokens and Access Tokens.

Request Example

curl
curl https://auth.agenticstar.jp/federation/auth/v1/jwks

Response Example

JSON
{
"keys": [
{
"kty": "RSA",
"kid": "key-id-1",
"use": "sig",
"n": "modulus...",
"e": "AQAB"
}
]
}

Revoke

POST /auth/v1/revoke

Revoke an access token or Refresh Token.

Request Headers

HeaderRequiredDescription
Content-TypeRequiredapplication/x-www-form-urlencoded

Request Body

ParameterTypeRequiredDescription
tokenstringRequiredToken to revoke (Access Token or Refresh Token)
client_idstringRequiredClient ID
client_secretstringRequiredClient Secret

Request Example

curl
curl -X POST https://auth.agenticstar.jp/federation/auth/v1/revoke \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "token=ACCESS_TOKEN" \
-d "client_id=my-client" \
-d "client_secret=my-secret"

On success, 204 No Content is returned.

Logout

GET /auth/v1/logout

RP-Initiated Logout endpoint. Terminates user session and redirects to specified URI. Access directly via web browser. A logout confirmation screen is displayed.

Query Parameters

ParameterTypeRequiredDescription
id_token_hintstringRecommendedID Token. Used to identify client (extracts client_id from JWT azp claim). Required if client_id parameter is not specified.
client_idstringClient ID. Can directly specify client instead of id_token_hint. This takes precedence if both are specified.
post_logout_redirect_uristringURI to redirect to after logout (pre-registration required)
logout_hintstringHint information for logout target
statestringState parameter returned during redirection
ui_localesstringDisplay language of logout screen (e.g., ja)
info

You must identify the client using either id_token_hint or client_id. If neither is specified, you will be redirected to an error page.

Request URL Example

https://auth.agenticstar.jp/federation/auth/v1/logout?\
id_token_hint=eyJhbGciOiJSUzI1NiJ9...&\
post_logout_redirect_uri=https%3A%2F%2Fapp.example.com%2F&\
state=abc123

JWT Specification

ID Token and Access Token are issued in JWT format. JWT is signed (signing algorithm: RS256) and consists of three parts: header.payload.signature.

JWT Structure

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLWlk....signature_part
JSON
{
"alg": "RS256",
"typ": "JWT",
"kid": "key-id-1"
}

Payload (Claims)

See the following sections for a detailed list of claims.

Claims List

Standard Claims

ClaimTypeDescription
substringSubject ID. UUID that uniquely identifies a user or service account within the authentication platform
issstringIssuer. Token issuer (https://auth.agenticstar.jp/federation)
audstringAudience. Token target (Client ID)
expnumberExpiration time (Unix timestamp)
iatnumberIssued at (Unix timestamp)
azpstringAuthorized Party. Client ID that requested the token
scopestringGranted scopes (space-separated)

Tenant Information (tenant.*)

Information about the tenant (enterprise / SaaS). Included in nested structure in Access Token and ID Token.

ClaimTypeDescriptionToken
tenant.idstringTenant IDAT / IDT
tenant.typestringenterprise or saasAT / IDT
tenant.endpointstringTenant endpoint URLAT / IDT

IdP Profile (idp.*)

User information retrieved from IdP (enterprise authentication platform). Included in nested structure. Also output in same structure if linked user is set in CC flow.

ClaimTypeDescriptionToken
idp.substringIdP User IDAT / IDT
idp.preferred_usernamestringIdP username (email address)AT / IDT
idp.display_namestringDisplay nameIDT
idp.emailstringEmail addressIDT
idp.organizationstringOrganizationAT / IDT
idp.jobstringJob titleAT / IDT
idp.biostringBioAT / IDT

Roles

ClaimTypeDescription
realm_access.rolesstring[]Roles assigned to user (e.g., user, admin, developer)

JWT Access Token Payload Example

JSON
{
"sub": "550e8400-e29b-41d4-a716-446655440000",
"iss": "https://auth.agenticstar.jp/federation",
"aud": "my-client",
"exp": 1704070800,
"iat": 1704067200,
"azp": "my-client",
"scope": "openid chat:all",
"tenant": {
"id": "enterprise-a",
"type": "enterprise",
"endpoint": "https://enterprise-a.example.com"
},
"idp": {
"sub": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
"preferred_username": "user@enterprise-a.com",
"organization": "Enterprise A Corp.",
"job": "Engineer",
"bio": "Software developer"
},
"realm_access": {
"roles": ["user"]
}
}

Scopes

Scope List

Below are the main scopes. See API Reference for a complete list.

Chat API

  • chat:exec - Execute chat
  • chat:history - View and delete chat history
  • chat:file - File operations
  • chat:all - All chat scopes

MCP / A2A

  • mcp:exec - Execute task via MCP
  • a2a:exec - Execute task via A2A

Scope Control Mechanism

By assigning scopes to a client in Console, the scopes included in the token are determined. Only scopes permitted by the user's role are granted in the token.

Scope Assignment Flow

Assign scopes to a client using Client Scope Role Mapping in Console. When generating the token, the scopes actually granted are determined by the following conditions:

  • Scopes assigned to the client
  • Intersection of scopes permitted by user role (user, admin, developer, etc.)
  • As a result, only necessary scopes within the user's role range are included in the token

Error Codes

OAuth 2.0 / OIDC Errors

Error CodeDescriptionHow to Respond
invalid_requestRequired parameters missing or format is invalidCheck request parameters
unauthorized_clientClient is not authorized, or Client ID is incorrectCheck Client ID and configuration
invalid_clientClient authentication failed (ID / Secret is incorrect)Check Client ID and Secret
invalid_grantAuthorization Code is invalid, expired, or already usedObtain a new Authorization Code
invalid_scopeRequested scope is invalid or not assignedAssign scope to client in Console
server_errorServer-side error such as communication error with authentication platformWait a while and try again. If the problem persists, contact support
invalid_tokenToken is invalid or expiredObtain a new token

HTTP Status Codes

StatusDescription
200 OKRequest succeeded
204 No ContentRequest succeeded (no response body)
302 FoundRedirect (Authorization / Logout endpoints)
400 Bad RequestRequest is invalid
401 UnauthorizedAuthentication failed or token is invalid
403 ForbiddenRequest is forbidden
500 Internal Server ErrorServer internal error