Authlete Token Endpoint API

API endpoints for implementing OAuth 2.0 Token Endpoint.

OpenAPI Specification

authlete-token-endpoint-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Authlete Authorization Endpoint Token Endpoint API
  description: "Welcome to the **Authlete API documentation**. Authlete is an **API-first service** where every aspect of the \nplatform is configurable via API. This documentation will help you authenticate and integrate with Authlete to \nbuild powerful OAuth 2.0 and OpenID Connect servers.\n\nAt a high level, the Authlete API is grouped into two categories:\n\n- **Management APIs**: Enable you to manage services and clients.\n- **Runtime APIs**: Allow you to build your own Authorization Servers or Verifiable Credential (VC) issuers.\n\n## \U0001F310 API Servers\n\nAuthlete is a global service with clusters available in multiple regions across the world:\n\n- \U0001F1FA\U0001F1F8 **US**: `https://us.authlete.com`\n- \U0001F1EF\U0001F1F5 **Japan**: `https://jp.authlete.com`\n- \U0001F1EA\U0001F1FA **Europe**: `https://eu.authlete.com`\n- \U0001F1E7\U0001F1F7 **Brazil**: `https://br.authlete.com`\n\nOur customers can host their data in the region that best meets their requirements.\n\n## \U0001F511 Authentication\n\nAll API endpoints are secured using **Bearer token authentication**. You must include an access token in every request:\n\n```\nAuthorization: Bearer YOUR_ACCESS_TOKEN\n```\n\n### Getting Your Access Token\n\nAuthlete supports two types of access tokens:\n\n**Service Access Token** - Scoped to a single service (authorization server instance)\n\n1. Log in to [Authlete Console](https://console.authlete.com)\n2. Navigate to your service → **Settings** → **Access Tokens**\n3. Click **Create Token** and select permissions (e.g., `service.read`, `client.write`)\n4. Copy the generated token\n\n**Organization Token** - Scoped to your entire organization\n\n1. Log in to [Authlete Console](https://console.authlete.com)\n2. Navigate to **Organization Settings** → **Access Tokens**\n3. Click **Create Token** and select org-level permissions\n4. Copy the generated token\n\n> ⚠️ **Important Note**: Tokens inherit the permissions of the account that creates them. Service tokens can only \n> access their specific service, while organization tokens can access all services within your org.\n\n### Token Security Best Practices\n\n- **Never commit tokens to version control** - Store in environment variables or secure secret managers\n- **Rotate regularly** - Generate new tokens periodically and revoke old ones\n- **Scope appropriately** - Request only the permissions your application needs\n- **Revoke unused tokens** - Delete tokens you're no longer using from the console\n\n### Quick Test\n\nVerify your token works with a simple API call:\n\n```bash\ncurl -X GET https://us.authlete.com/api/service/get/list \\\n  -H \"Authorization: Bearer YOUR_ACCESS_TOKEN\"\n```\n\n## \U0001F393 Tutorials\n\nIf you're new to Authlete or want to see sample implementations, these resources will help you get started:\n\n- [Getting Started with Authlete](https://www.authlete.com/developers/getting_started/)\n- [From Sign-Up to the First API Request](https://www.authlete.com/developers/tutorial/signup/)\n\n## \U0001F6E0 Contact Us\n\nIf you have any questions or need assistance, our team is here to help:\n\n- [Contact Page](https://www.authlete.com/contact/)\n"
  version: 3.0.16
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- description: 🇺🇸 US Cluster
  url: https://us.authlete.com
- description: 🇯🇵 Japan Cluster
  url: https://jp.authlete.com
- description: 🇪🇺 Europe Cluster
  url: https://eu.authlete.com
- description: 🇧🇷 Brazil Cluster
  url: https://br.authlete.com
security:
- bearer: []
tags:
- name: Token Endpoint
  description: API endpoints for implementing OAuth 2.0 Token Endpoint.
  x-tag-expanded: false
paths:
  /api/{serviceId}/auth/token:
    post:
      summary: Process Token Request
      description: 'This API parses request parameters of an authorization request and returns necessary data for the

        authorization server implementation to process the authorization request further.

        '
      x-mint:
        metadata:
          description: This API parses request parameters of an authorization request and returns necessary data for the authorization server implementation to process the authorization request further.
        content: '<Accordion title="Full description" defaultOpen={false}>

          This API is supposed to be called from with the implementation of the token endpoint of the service.

          The endpoint implementation must extract the request parameters from the token request from the

          client application and pass them as the value of parameters request parameter to Authlete''s `/auth/token` API.

          The value of parameters is the entire entity body (which is formatted in `application/x-www-form-urlencoded`)

          of the token request.

          In addition, if the token endpoint of the authorization server implementation supports basic authentication

          as a means of [client authentication](https://datatracker.ietf.org/doc/html/rfc6749#section-2.3),

          the client credentials must be extracted from `Authorization` header and they must be passed as

          `clientId` request parameter and `clientSecret` request parameter to Authlete''s `/auth/token` API.

          The following code snippet is an example in JAX-RS showing how to extract request parameters from

          the token request and client credentials from Authorization header.

          ```java

          @POST

          @Consumes(MediaType.APPLICATION_FORM_URLENCODED)

          public Response post(

          @HeaderParam(HttpHeaders.AUTHORIZATION) String auth,

          String parameters)

          &#123;

          // Convert the value of Authorization header (credentials of

          // the client application), if any, into BasicCredentials.

          BasicCredentials credentials = BasicCredentials.parse(auth);

          // The credentials of the client application extracted from

          // ''Authorization'' header. These may be null.

          String clientId = credentials == null ? null

          : credentials.getUserId();

          String clientSecret = credentials == null ? null

          : credentials.getPassword();

          // Process the given parameters.

          return process(parameters, clientId, clientSecret);

          &#125;

          ```

          The response from `/auth/token` API has some parameters. Among them, it is action parameter that

          the service implementation should check first because it denotes the next action that the authorization

          server implementation should take. According to the value of action, the authorization server

          implementation must take the steps described below.


          ## INTERNAL_SERVER_ERROR


          When the value of `action` is `INTERNAL_SERVER_ERROR`, it means that the request from the authorization

          server implementation was wrong or that an error occurred in Authlete.

          In either case, from the viewpoint of the client application, it is an error on the server side.

          Therefore, the service implementation should generate a response to the client application with

          HTTP status of "500 Internal Server Error". Authlete recommends `application/json` as the content

          type although OAuth 2.0 specification does not mention the format of the error response when the

          redirect URI is not usable.

          The value of `responseContent` is a JSON string which describes the error, so it can be

          used as     the entity body of the response.


          ---


          The following illustrates the response which the service implementation should generate and return

          to the client application.

          ```

          HTTP/1.1 500 Internal Server Error

          Content-Type: application/json

          Cache-Control: no-store

          Pragma: no-cache

          &#123;responseContent&#125;

          ```

          The endpoint implementation may return another different response to the client application

          since "500 Internal Server Error" is not required by OAuth 2.0.


          ## INVALID_CLIENT


          When the value of `action` is `INVALID_CLIENT`, it means that authentication of the client failed.

          In this case, the HTTP status of the response to the client application is either "400 Bad Request"

          or "401 Unauthorized". This requirement comes from [RFC 6749, 5.2. Error Response](https://datatracker.ietf.org/doc/html/rfc6749#section-5.2).

          The description about `invalid_client` shown below is an excerpt from RFC 6749.


          ---


          Client authentication failed (e.g., unknown client, no client authentication included, or unsupported

          authentication method). The authorization server MAY return an HTTP 401 (Unauthorized) status code

          to indicate which HTTP authentication schemes are supported. If the client attempted to authenticate

          via the `Authorization` request header field, the authorization server MUST respond with an HTTP

          401 (Unauthorized) status code and include the `WWW-Authenticate` response header field matching

          the authentication scheme used by the client.


          ---


          In either case, the value of `responseContent` is a JSON string which can be used as the entity

          body of the response to the client application.


          ---


          The following illustrate responses which the service implementation must generate and return to

          the client application.


          ```

          HTTP/1.1 400 Bad Request

          Content-Type: application/json

          Cache-Control: no-store

          Pragma: no-cache

          &#123;responseContent&#125;

          ```


          ```

          HTTP/1.1 401 Unauthorized

          WWW-Authenticate: &#123;challenge&#125;

          Content-Type: application/json

          Cache-Control: no-store

          Pragma: no-cache

          &#123;responseContent&#125;

          ```


          ## BAD_REQUEST


          When the value of `action` is `BAD_REQUEST`, it means that the request from the client application

          is invalid.

          A response with HTTP status of "400 Bad Request" must be returned to the client application and

          the content type must be `application/json`.

          The value of `responseContent` is a JSON string which describes the error, so it can be used as

          the entity body of the response.


          The following illustrates the response which the service implementation should generate and return

          to the client application.


          ```

          HTTP/1.1 400 Bad Request

          Content-Type: application/json

          Cache-Control: no-store

          Pragma: no-cache

          &#123;responseContent&#125;

          ```


          ## PASSWORD


          When the value of `"action"` is `"PASSWORD"`, it means that

          the request from the client application is valid and `grant_type`

          is `"password"`. That is, the flow is

          ["Resource Owner

          Password Credentials"](https://www.rfc-editor.org/rfc/rfc6749.html#section-4.3).

          In this case, &#123;@link #getUsername()&#125; returns the value of `"username"`

          request parameter and &#123;@link #getPassword()&#125; returns the value of &#123;@code

          "password"&#125; request parameter which were contained in the token request

          from the client application. The service implementation must validate the

          credentials of the resource owner (= end-user) and take either of the

          actions below according to the validation result.

          1. When the credentials are valid, call Authlete''s /auth/token/issue&#125; API to generate an access token for the client

          application. The API requires `"ticket"` request parameter and

          `"subject"` request parameter.

          Use the value returned from &#123;@link #getTicket()&#125; method as the value

          for `"ticket"` parameter.

          2. The response from `/auth/token/issue` API (&#123;@link

          TokenIssueResponse&#125;) contains data (an access token and others)

          which should be returned to the client application. Use the data

          to generate a response to the client application.

          3. When the credentials are invalid, call Authlete''s &#123;@code

          /auth/token/fail&#125; API with `reason=`&#123;@link

          TokenFailRequest.Reason#INVALID_RESOURCE_OWNER_CREDENTIALS

          INVALID_RESOURCE_OWNER_CREDENTIALS&#125; to generate an error response

          for the client application. The API requires `"ticket"`

          request parameter. Use the value returned from &#123;@link #getTicket()&#125;

          method as the value for `"ticket"` parameter.

          4. The response from `/auth/token/fail` API (&#123;@link

          TokenFailResponse&#125;) contains error information which should be

          returned to the client application. Use it to generate a response

          to the client application.


          ## OK


          When the value of `action` is `OK`, it means that the request from the client application is valid

          and an access token, and optionally an ID token, is ready to be issued.

          The HTTP status of the response returned to the client application must be "200 OK" and the content

          type must be `application/json`.

          The value of `responseContent` is a JSON string which contains an access token (and optionally

          an ID token), so it can be used as     the entity body of the response.


          ---


          The following illustrates the response which the service implementation must generate and return

          to the client application.

          ```

          HTTP/1.1 200 OK

          Content-Type: application/json

          Cache-Control: no-store

          Pragma: no-cache

          &#123;responseContent&#125;

          ```


          ## TOKEN_EXCHANGE (Authlete 2.3 onwards)


          When the value of `"action"` is `"TOKEN_EXCHANGE"`, it means

          that the request from the client application is a valid token exchange

          request (cf. [RFC

          8693 OAuth 2.0 Token Exchange](https://www.rfc-editor.org/rfc/rfc8693.html)) and that the request has already passed

          the following validation steps.

          1. Confirm that the value of the `requested_token_type` request parameter

          is one of the registered token type identifiers if the request parameter is

          given and its value is not empty.

          2. Confirm that the `subject_token` request parameter is given and its

          value is not empty.

          3. Confirm that the `subject_token_type` request parameter is given and

          its value is one of the registered token type identifiers.

          4. Confirm that the `actor_token_type` request parameter is given and

          its value is one of the registered token type identifiers if the

          `actor_token` request parameter is given and its value is not empty.

          5. Confirm that the `actor_token_type` request parameter is not given

          or its value is empty when the `actor_token` request parameter is

          not given or its value is empty.

          Furthermore, Authlete performs additional validation on the tokens specified

          by the `subject_token` request parameter and the `actor_token`

          request parameter according to their respective token types as shown below.


          ## Token Validation Steps

          \*Token Type: `urn:ietf:params:oauth:token-type:jwt`\*

          1. Confirm that the format conforms to the JWT specification [RFC 7519][https://www.rfc-editor.org/rfc/rfc7519.html].

          2. Check if the JWT is encrypted and if it is encrypted, then (a) reject

          the token exchange request when the &#123;@link

          Service#isTokenExchangeEncryptedJwtRejected()

          tokenExchangeEncryptedJwtRejected&#125; flag of the service is `true`

          or (b) skip remaining validation steps when the flag is `false`.

          Note that Authlete does not verify an encrypted JWT because there is

          no standard way to obtain the key to decrypt the JWT with. This means

          that you must verify an encrypted JWT by yourself when one is used as

          an input token with the token type

          &#123; @code "urn:ietf:params:oauth:token-type:jwt" &#125;.

          3. Confirm that the current time has not reached the time indicated by

          the `exp` claim if the JWT contains the claim.

          4. Confirm that the current time is equal to or after the time indicated

          by the `iat` claim if the JWT contains the claim.

          5.Confirm that the current time is equal to or after the time indicated

          by the `nbf` claim if the JWT contains the claim.

          6. Check if the JWT is signed and if it is not signed, then (a) reject

          the token exchange request when the &#123;@link

          Service#isTokenExchangeUnsignedJwtRejected()

          tokenExchangeUnsignedJwtRejected&#125; flag of the service is `true`

          or (b) finish validation on the input token. Note that Authlete does

          not verify the signature of the JWT because there is no standard way

          to obtain the key to verify the signature of a JWT with. This means

          that you must verify the signature by yourself when a signed JWT is

          used as an input token with the token type

          `"urn:ietf:params:oauth:token-type:jwt"`.

          \*Token Type: `urn:ietf:params:oauth:token-type:access_token`\*

          1. Confirm that the token is an access token that has been issued by

          the Authlete server of your service. This implies that access

          tokens issued by other systems cannot be used as a subject token

          or an actor token with the token type

          `urn:ietf:params:oauth:token-type:access_token`.

          2. Confirm that the access token has not expired.

          3. Confirm that the access token belongs to the service.

          \*Token Type: `urn:ietf:params:oauth:token-type:refresh_token`\*

          1. Confirm that the token is a refresh token that has been issued by

          the Authlete server of your service. This implies that refresh

          tokens issued by other systems cannot be used as a subject token

          or an actor token with the token type

          `urn:ietf:params:oauth:token-type:refresh_token`.

          2. Confirm that the refresh token has not expired.

          3. Confirm that the refresh token belongs to the service.

          \*Token Type: `urn:ietf:params:oauth:token-type:id_token`\*

          1. Confirm that the format conforms to the JWT specification ([RFC 7519](https://www.rfc-editor.org/rfc/rfc7519.html)).

          2. Check if the ID Token is encrypted and if it is encrypted, then (a)

          reject the token exchange request when the &#123;@link

          Service#isTokenExchangeEncryptedJwtRejected()

          tokenExchangeEncryptedJwtRejected&#125; flag of the service is `true`

          or (b) skip remaining validation steps when the flag is `false`.

          Note that Authlete does not verify an encrypted ID Token because

          there is no standard way to obtain the key to decrypt the ID Token

          with in the context of token exchange where the client ID for the

          encrypted ID Token cannot be determined. This means that you must

          verify an encrypted ID Token by yourself when one is used as an

          input token with the token type

          `"urn:ietf:params:oauth:token-type:id_token"`.

          3. Confirm that the ID Token contains the `exp` claim and the

          current time has not reached the time indicated by the claim.

          4. Confirm that the ID Token contains the `iat` claim and the

          current time is equal to or after the time indicated by the claim.

          5. Confirm that the current time is equal to or after the time indicated

          by the `nbf` claim if the ID Token contains the claim.

          6. Confirm that the ID Token contains the `iss` claim and the

          value is a valid URI. In addition, confirm that the URI has the

          `https` scheme, no query component and no fragment component.

          7. Confirm that the ID Token contains the `aud` claim and its

          value is a JSON string or an array of JSON strings.

          8. Confirm that the value of the `nonce` claim is a JSON string

          if the ID Token contains the claim.

          9. Check if the ID Token is signed and if it is not signed, then (a)

          reject the token exchange request when the &#123;@link

          Service#isTokenExchangeUnsignedJwtRejected()

          tokenExchangeUnsignedJwtRejected&#125; flag of the service is `true`

          or (b) finish validation on the input token.

          10. Confirm that the signature algorithm is asymmetric. This implies that

          ID Tokens whose signature algorithm is symmetric (`HS256`,

          `HS384` or `HS512`) cannot be used as a subject token or

          an actor token with the token type

          `urn:ietf:params:oauth:token-type:id_token`.

          11. Verify the signature of the ID Token. Signature verification is

          performed even in the case where the issuer of the ID Token is not

          your service. But in that case, the issuer must support the discovery

          endpoint defined in [OpenID

          Connect Discovery 1.0](https://openid.net/specs/openid-connect-discovery-1_0.html). Otherwise, signature verification fails.

          \*Token Type: `urn:ietf:params:oauth:token-type:saml1`\*

          (Authlete does not perform any validation for this token type.)

          \*Token Type: `urn:ietf:params:oauth:token-type:saml2`\*

          (Authlete does not perform any validation for this token type.)

          The specification of Token Exchange ([RFC 8693](https://www.rfc-editor.org/rfc/rfc8693.html)) is very

          flexible. In other words, the specification has abandoned the task of

          determining details. Therefore, for secure token exchange, you have

          to complement the specification with your own rules. For that purpose,

          Authlete provides some configuration options as listed below.

          Authorization server implementers may utilize them and/or implement

          their own rules.

          In the case of &#123;@link Action#TOKEN_EXCHANGE TOKEN_EXCHANGE&#125;, the &#123;@link

          #getResponseContent()&#125; method returns `null`. You have to construct

          the token response by yourself.

          For example, you may generate an access token by calling Authlete''s

          `/api/auth/token/create` API and construct a token response like

          below.

          ```

          HTTP/1.1 401 Unauthorized

          WWW-Authenticate: &#123;challenge&#125;

          Content-Type: application/json

          Cache-Control: no-store

          Pragma: no-cache

          &#123;responseContent&#125;

          ```

          ```

          HTTP/1.1 200 OK

          Content-Type: application/json

          Cache-Control: no-cache, no-store

          &#123;

          "access_token": "&#123;@link TokenCreateResponse#getAccessToken()&#125;",

          "issued_token_type": "urn:ietf:params:oauth:token-type:access_token",

          "token_type": "Bearer",

          "expires_in": &#123; @link TokenCreateResponse#getExpiresIn() &#125;,

          "scope": "String.join(" ", &#123;@link TokenCreateResponse#getScopes()&#125;)"

          &#125;

          ```


          ## JWT_BEARER JWT_BEARER (Authlete 2.3 onwards)


          When the value of `"action"` is `"JWT_BEARER"`, it means that

          the request from the client application is a valid token request with the

          grant type `"urn:ietf:params:oauth:grant-type:jwt-bearer"` ([RFC 7523 JSON Web Token (JWT)

          Profile for OAuth 2.0 Client Authentication and Authorization Grants](https://www.rfc-editor.org/rfc/rfc7523.html))

          and that the request has already passed the following validation steps.

          1. Confirm that the `assertion` request parameter is given and its value

          is not empty.

          2. Confirm that the format of the assertion conforms to the JWT specification

          ([RFC 7519](https://www.rfc-editor.org/rfc/rfc7519.html)).

          3. Check if the JWT is encrypted and if it is encrypted, then (a) reject the

          token request when the &#123;@link Service#isJwtGrantEncryptedJwtRejected()

          jwtGrantEncryptedJwtRejected&#125; flag of the service is `true` or (b)

          skip remaining validation steps when the flag is `false`. Note that

          Authlete does not verify an encrypted JWT because there is no standard way

          to obtain the key to decrypt the JWT with. This means that you must verify

          an encrypted JWT by yourself.

          4. Confirm that the JWT contains the `iss` claim and its value is a

          JSON string.

          5. Confirm that the JWT contains the `sub` claim and its value is a

          JSON string.

          6. Confirm that the JWT contains the `aud` claim and its value is

          either a JSON string or an array of JSON strings.

          7. Confirm that the issuer identifier of the service (cf. &#123;@link Service#getIssuer()&#125;)

          or the URL of the token endpoint (cf. &#123;@link Service#getTokenEndpoint()&#125;)

          is listed as audience in the `aud` claim.

          8. Confirm that the JWT contains the `exp` claim and the current time

          has not reached the time indicated by the claim.

          9. Confirm that the current time is equal to or after the time indicated by

          by the `iat` claim if the JWT contains the claim.

          10. Confirm that the current time is equal to or after the time indicated by

          by the `nbf` claim if the JWT contains the claim.

          11. Check if the JWT is signed and if it is not signed, then (a) reject the

          token request when the &#123;@link Service#isJwtGrantUnsignedJwtRejected()

          jwtGrantUnsignedJwtRejected&#125; flag of the service is `true` or (b)

          finish validation on the JWT. Note that Authlete does not verify the

          signature of the JWT because there is no standard way to obtain the key

          to verify the signature of a JWT with. This means that you must verify

          the signature by yourself.

          Authlete provides some configuration options for the grant type as listed

          below. Authorization server implementers may utilize them and/or implement

          their own rules.

          ```

          HTTP/1.1 200 OK

          Content-Type: application/json

          Cache-Control: no-cache, no-store

          &#123;

          "access_token": "&#123;@link TokenCreateResponse#getAccessToken()&#125;",

          "token_type": "Bearer",

          "expires_in": &#123;@link TokenCreateResponse#getExpiresIn()&#125;,

          "scope": "String.join(" ", &#123;@link TokenCreateResponse#getScopes()&#125;)"

          &#125;

          ```

          Finally, note again that Authlete does not verify the signature of the JWT

          specified by the `assertion` request parameter. You must verify the

          signature by yourself.

          </Accordion>

          '
      parameters:
      - in: path
        name: serviceId
        description: A service ID.
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/token_request'
            example:
              parameters: grant_type=authorization_code&code=Xv_su944auuBgc5mfUnxXayiiQU9Z4-T_Yae_UfExmo&redirect_uri=https%3A%2F%2Fmy-client.example.com%2Fcb1&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
              clientId: '26478243745571'
              clientSecret: gXz97ISgLs4HuXwOZWch8GEmgL4YMvUJwu3er_kDVVGcA0UOhA9avLPbEmoeZdagi9yC_-tEiT2BdRyH9dbrQQ
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/token_request'
      responses:
        '200':
          description: Token operation completed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/token_response'
              example:
                resultCode: A050001
                resultMessage: '[A050001] The token request (grant_type=authorization_code) was processed successfully.'
                accessToken: C4SrUTijIj2IxqE1xBASr3dxQWgso3BpY49g8CyjGjQ
                accessTokenDuration: 3600
                accessTokenExpiresAt: 1640252942736
                action: OK
                clientAttributes:
                - key: attribute1-key
                  value: attribute1-value
                - key: attribute2-key
                  value: attribute2-value
                clientId: 26478243745571
                clientIdAlias: my-client
                clientIdAliasUsed: false
                grantType: AUTHORIZATION_CODE
                refreshToken: 60k0cZ38sJcpTgdxvG9Sqa-3RG5AmGExGpFB-1imSxo
                refreshTokenDuration: 3600
                refreshTokenExpiresAt: 1640252942736
                responseContent: '{\"access_token\":\"C4SrUTijIj2IxqE1xBASr3dxQWgso3BpY49g8CyjGjQ\",\"refresh_token\":\"60k0cZ38sJcpTgdxvG9Sqa-3RG5AmGExGpFB-1imSxo\",\"scope\":\"history.read timeline.read\",\"token_type\":\"Bearer\",\"expires_in\":3600}'
                scopes:
                - history.read
                - timeline.read
                serviceAttributes:
                - key: attribute1-key
                  value: attribute1-value
                - key: attribute2-key
                  value: attribute2-value
                subject: john
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '500':
          $ref: '#/components/responses/500'
      operationId: auth_token_api
      x-code-samples:
      - lang: shell
        label: curl
        source: 'curl -v -X POST https://us.authlete.com/api/21653835348762/auth/token \

          -H ''Content-Type: application/json'' \

          -H ''Authorization: Bearer V5a40R6dWvw2gMkCOBFdZcM95q4HC0Z-T0YKD9-nR6F'' \

          -d ''{ "parameters": "grant_type=authorization_code&code=Xv_su944auuBgc5mfUnxXayiiQU9Z4-T_Yae_UfExmo&redirect_uri=https%3A%2F%2Fmy-client.example.com%2Fcb1&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "clientId": "57297408867", "clientSecret": "J_3C7P0nDTP7CwCg_HyPQh7bTQ1696CC8GWot-EjesZmdBiU5Gsidq5Ve3tMaN2x2_VcKV1UE1U3ZdGKRuTs7A" }''

          '
      - lang: java
        label: java
        source: 'AuthleteConfiguration conf = ...;

          AuthleteApi api = AuthleteApiFactory.create(conf);


          TokenRequest req = new TokenRequest();

          req.setParameters(...);

          req.setClientId("57297408867");

          req.setClientSecret("J_3C7P0nDTP7CwCg_HyPQh7bTQ1696CC8GWot-EjesZmdBiU5Gsidq5Ve3tMaN2x2_VcKV1UE1U3ZdGKRuTs7A");


          api.token(req);

          '
      - lang: python
        source: 'conf = ...

          api = AuthleteApiImpl(conf)


          req = TokenRequest()

          req.parameters = ...

          req.clientId = ''57297408867''

          req.clientSecret = ''J_3C7P0nDTP7CwCg_HyPQh7bTQ1696CC8GWot-EjesZmdBiU5Gsidq5Ve3tMaN2x2_VcKV1UE1U3ZdGKRuTs7A''


          api.token(req)

          '
      tags:
      - Token Endpoint
  /api/{serviceId}/auth/token/fail:
    post:
      summary: Fail Token Request
      description: 'This API generates a content of an error token response that the authorization server implementation

        returns to the client application.

        '
      x-mint:
        metadata:
          description: This API generates a content of an error token response that the authorization server implementation returns to the client application.
        content: '<Accordion title="Full description" defaultOpen={false}>

 

# --- truncated at 32 KB (90 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/authlete/refs/heads/main/openapi/authlete-token-endpoint-api-openapi.yml