> ## Agent Instructions > ### Authlete versions > Authlete 3.0 is the current version. Unless the user says they use another version, answer for Authlete 3.0 using the 3.x documentation. > Documentation for Authlete 2.x (pages under `/v2/` and `/ja/v2/`) is for the legacy version. Refer to it only when the user is on Authlete 2.x. > > ### Authlete architecture > Authlete is a backend engine for OAuth 2.0 and OpenID Connect processing. End users and client applications do not call it directly; the service provider's authorization server and API server call Authlete's APIs. Authlete handles protocol processing and token, client, and service management, while the service provider owns the OAuth/OIDC endpoints and user authentication. > See [Architecture](https://developers.authlete.com/get-started/introduction-to-authlete/architecture.md). > > ### Concepts > If the user is new to Authlete, read these pages first: > - [Request and Response](https://developers.authlete.com/get-started/concepts/request-and-response.md): Core API requests pass the client's request parameters as-is, and responses return `resultCode`, `action`, and `responseContent`. > - [Action Handling](https://developers.authlete.com/get-started/concepts/action-handling.md): Branch on `action`, never on `resultCode`, and map each action to the HTTP response your server returns. > - [Two-Step API Calls](https://developers.authlete.com/get-started/concepts/two-step-api-calls.md): Actions such as `INTERACTION` are completed with a second call (`/auth/authorization/issue` or `/auth/authorization/fail`) linked by a `ticket`. > - [Management API Overview](https://developers.authlete.com/get-started/concepts/overview.md): The Management API configures services, manages clients, and operates issued tokens, separately from the protocol flows handled by the Core API. > - [API Authentication](https://developers.authlete.com/get-started/concepts/authentication.md): Authlete APIs use bearer tokens: a Service Access Token (one service) or an Organization Token (the whole organization). # Get Audit Log Event Types Source: https://developers.authlete.com/api-reference/audit-logs/get-audit-log-event-types https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/audit/types Returns the list of available audit log event types for this environment. Accessible with a user access token or an organization token that has the `view_audit_log` permission (e.g. a token created with the `admin` or `audit_reader` preset). This endpoint is hosted on the Authlete IdP server (`https://login.authlete.com`), not on the regional API clusters. # Get Audit Logs Source: https://developers.authlete.com/api-reference/audit-logs/get-audit-logs https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/audit/entries Retrieve audit logs as a cursor-paginated list. Results can be filtered by time range, event type, and organization. The response contains a page of roughly `limit` entries together with a `nextCursor` value. Entries sharing the same timestamp are never split across pages, so a page may occasionally contain more than `limit` entries. To fetch the next page, repeat the request with the `cursor` parameter set to the `nextCursor` value from the previous response, keeping the other filter parameters unchanged. `nextCursor` is absent on the last page. If both `before` and `cursor` are provided, `cursor` takes precedence. This endpoint is hosted on the Authlete IdP server (`https://login.authlete.com`), not on the regional API clusters. # Fail Authorization Request Source: https://developers.authlete.com/api-reference/authorization-endpoint/fail-authorization-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/authorization/fail This API generates a content of an error authorization response that the authorization server implementation returns to the client application. This API is supposed to be called from within the implementation of the authorization endpoint of the service in order to generate an error response to the client application. The description of the `/auth/authorization` API describes the timing when this API should be called. The response from `/auth/authorization/fail` API has some parameters. Among them, it is `action` parameter that the authorization server 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. 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 {responseContent} ``` The endpoint implementation may return another different response to the client application since "500 Internal Server Error" is not required by OAuth 2.0. ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the ticket is no longer valid (deleted or expired) and that the reason of the invalidity was probably due to the end-user's too-delayed response to the authorization UI. A response with HTTP status of "400 Bad Request" should be returned to the client application and Authlete recommends `application/json` as the content type. 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 {responseContent} ``` The endpoint implementation may return another different response to the client application since "400 Bad Request" is not required by OAuth 2.0. ## LOCATION When the value of `action` is `LOCATION`, it means that the response to the client application must be "302 Found" with Location header. The parameter responseContent contains a redirect URI with (1) an authorization code, an ID token and/or an access token (on success) or (2) an error code (on failure), so it can be used as the value of `Location` header. *** The following illustrates the response which the service implementation must generate and return to the client application. ``` HTTP/1.1 302 Found Location: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## FORM When the value of `action` is `FORM`, it means that the response to the client application must be 200 OK with an HTML which triggers redirection by JavaScript. This happens when the authorization request from the client application contained `response_mode=form_post`. The value of `responseContent` is an HTML which 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: text/html;charset=UTF-8 Cache-Control: no-store Pragma: no-cache {responseContent} ``` # Get Ticket Information Source: https://developers.authlete.com/api-reference/authorization-endpoint/get-ticket-information https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/authorization/ticket/info # Issue Authorization Response Source: https://developers.authlete.com/api-reference/authorization-endpoint/issue-authorization-response https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/authorization/issue This API parses request parameters of an authorization request and returns necessary data for the authorization server implementation to process the authorization request further. This API is supposed to be called from within the implementation of the authorization endpoint of the service in order to generate a successful response to the client application. The description of the `/auth/authorization` API describes the timing when this API should be called and the meaning of request parameters. See \[ISSUE] in `NO_INTERACTION`. The response from `/auth/authorization/issue` API has some parameters. Among them, it is `action` parameter that the authorization server 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". 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 {responseContent} ``` The endpoint implementation may return another different response to the client application since "500 Internal Server Error" is not required by OAuth 2.0. ## BAD\_REQUEST When the value of "action" is `BAD_REQUEST`, it means that the ticket is no longer valid (deleted or expired) and that the reason of the invalidity was probably due to the end-user's too-delayed response to the authorization UI. The HTTP status of the response returned to the client application should be "400 Bad Request" and the content type should be `application/json` although OAuth 2.0 specification does not mention the format of the error response. 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 {responseContent} ``` The endpoint implementation may return another different response to the client application since "400 Bad Request" is not required by OAuth 2.0. ## LOCATION When the value of `action` is `LOCATION`, it means that the response to the client application should be "302 Found" with `Location` header. The value of `responseContent` is a redirect URI which contains (1) an authorization code, an ID token and/or an access token (on success) or (2) an error code (on failure), so it can be used as the value of `Location` header. *** The following illustrates the response which the service implementation must generate and return to the client application. ``` HTTP/1.1 302 Found Location: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## FORM When the value of `action` is `FORM`, it means that the response to the client application should be "200 OK" with an HTML which triggers redirection by JavaScript. This happens when the authorization request from the client contains `response_mode=form_post` request parameter. The value of `responseContent` is an HTML which satisfies the requirements of `response_mode=form_post`, 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 200 OK Content-Type: text/html;charset=UTF-8 Cache-Control: no-store Pragma: no-cache {responseContent} ``` # Process Authorization Request Source: https://developers.authlete.com/api-reference/authorization-endpoint/process-authorization-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/authorization This API parses request parameters of an authorization request and returns necessary data for the authorization server implementation to process the authorization request further. This API is supposed to be called from within the implementation of the authorization endpoint of the service. The endpoint implementation must extract the request parameters from the authorization request from the client application and pass them as the value of parameters request parameter for Authlete's `/auth/authorization` API. The value of `parameters` is either (1) the entire query string when the HTTP method of the request from the client application is `GET` or (2) the entire entity body (which is formatted in `application/x-www-form-urlencoded`) when the HTTP method of the request from the client application is `POST`. The following code snippet is an example in JAX-RS showing how to extract request parameters from the authorization request. ```java @GET public Response get(@Context UriInfo uriInfo) { // The query parameters of the authorization request. String parameters = uriInfo.getRequestUri().getQuery(); ...... } @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response post(String parameters) { // 'parameters' is the entity body of the authorization request. ...... } ``` The endpoint implementation does not have to parse the request parameters from the client application because Authlete's `/auth/authorization` API does it. The response from `/auth/authorization` API has various parameters. Among them, it is `action` parameter that the authorization server implementation should check first because it denotes the next action that the authorization server implementation should take. According to the value of `action`, the service 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 {responseContent} ``` The endpoint implementation may return another different response to the client application since "500 Internal Server Error" is not required by OAuth 2.0. ## 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" should be returned to the client application and 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 400 Bad Request Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` The endpoint implementation may return another different response to the client application since "400 Bad Request" is not required by OAuth 2.0. ## LOCATION When the value of `action` is `LOCATION`, it means that the request from the client application is invalid but the redirect URI to which the error should be reported has been determined. A response with HTTP status of "302 Found" must be returned to the client application with `Location` header which has a redirect URI with error parameter. The value of `responseContent` is a redirect URI with `error` parameter, so it can be used as the value of `Location` header. The following illustrates the response which the service implementation must generate and return to the client application. ``` HTTP/1.1 302 Found Location: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## FORM When the value of `action` is `FORM`, it means that the request from the client application is invalid but the redirect URI to which the error should be reported has been determined, and that the authorization request contains `response_mode=form_post` as is defined in [OAuth 2.0 Form Post Response Mode](https://openid.net/specs/oauth-v2-form-post-response-mode-1_0.html). The HTTP status of the response returned to the client application should be "200 OK" and the content type should be `text/html;charset=UTF-8`. The value of `responseContent` is an HTML which 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: text/html;charset=UTF-8 Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## NO\_INTERACTION When the value of `action` is `NO_INTERACTION`, it means that the request from the client application has no problem and requires the service to process the request without displaying any user interface pages for authentication or consent. This case happens when the authorization request contains `prompt=none`. The service must follow the steps described below. **\[1] END-USER AUTHENTICATION** Check whether an end-user has already logged in. If an end-user has logged in, go to the next step (\[MAX\_AGE]). Otherwise, call Authlete's `/auth/authorization/fail` API with `reason=NOT_LOGGED_IN` and use the response from the API to generate a response to the client application. **\[2] MAX AGE** Get the value of `maxAge` parameter from the `/auth/authorization` API response. The value represents the maximum authentication age which has come from `max_age` request parameter or `defaultMaxAge` configuration parameter of the client application. If the value is `0`, go to the next step (\[SUBJECT]). Otherwise, follow the sub steps described below. * (i) Get the time at which the end-user was authenticated. Note that this value is not managed by Authlete, meaning that it is expected that the service implementation manages the value. If the service implementation does not manage authentication time of end-users, call Authlete's `/auth/authorization/fail` API with `reason=MAX_AGE_NOT_SUPPORTED` and use the API response to generate a response to the client application. * (ii) Add the value of the maximum authentication age (which is represented in seconds) to the authentication time. The calculated value is the expiration time. * (iii) Check whether the calculated value is equal to or greater than the current time. If this condition is satisfied, go to the next step (\[SUBJECT]). Otherwise, call Authlete's `/auth/authorization/fail` API with `reason=EXCEEDS_MAX_AGE` and use the API response to generate a response to the client application. **\[3] SUBJECT** Get the value of `subject` from the `/auth/authorization` API response. The value represents an end-user who the client application expects to grant authorization. If the value is `null`, go to the next step (\[ACRs]). Otherwise, follow the sub steps described below. * (i) Compare the value of the requested subject to the current end-user. * (ii) If they are equal, go to the next step (\[ACRs]). If they are not equal, call Authlete's `/auth/authorization/fail` API with `reason=DIFFERENT_SUBJECT` and use the response from the API to generate a response to the client application. **\[4] ACRs** Get the value of `acrs` from the `/auth/authorization` API response. The value represents a list of ACRs (Authentication Context Class References) and comes from (1) acr claim in `claims` request parameter, (2) `acr_values` request parameter, or (3) `default_acr_values` configuration parameter of the client application. It is ensured that all the ACRs in acrs are supported by the authorization server implementation. In other words, it is ensured that all the ACRs are listed in `acr_values_supported` configuration parameter of the authorization server. If the value of ACRs is `null`, go to the next step (\[ISSUE]). Otherwise, follow the sub steps described below. * (i) Get the ACR performed for the authentication of the current end-user. Note that this value is managed not by Authlete but by the authorization server implementation. (If the authorization server implementation cannot handle ACRs, it should not have listed ACRs as `acr_values_supported`.) * (ii) Compare the ACR value obtained in the above step to each element in the ACR array (`acrs`) in the listed order. * (iii) If the ACR value was found in the array, (= the ACR performed for the authentication of the current end-user did not match any one of the ACRs requested by the client application), check whether one of the requested ACRs must be satisfied or not using `acrEssential` parameter in the `/auth/authorization` API response. If the value of `acrEssential` parameter is `true`, call Authlete's `/auth/authorization/fail` API with `reason=ACR_NOT_SATISFIED` and use the response from the API to generate a response to the client application. Otherwise, go to the next step (\[SCOPES]). **\[5] SCOPES** Get the value of `scopes` from the `/auth/authorization` API response. If the array contains a scope which has not been granted to the client application by the end-user in the past, call Authlete's `/auth/authorization/fail` API with `reason=CONSENT_REQUIRED` and use the response from the API to generate a response to the client application. Otherwise, go to the next step (\[RESOURCES]). Note that Authlete provides APIs to manage records of granted scopes (`/api/client/granted_scopes/*` APIs), which is only available in a dedicated/onpremise Authlete server (contact [sales@authlete.com](mailto:sales@authlete.com) for details). **\[6] DYNAMIC SCOPES** Get the value of `dynamicScopes` from the `/auth/authorization` API response. If the array contains a scope which has not been granted to the client application by the end-user in the past, call Authlete's `/auth/authorization/fail` API with `reason=CONSENT_REQUIRED` and use the response from the API to generate a response to the client application. Otherwise, go to the next step (\[RESOURCES]). Note that Authlete provides APIs to manage records of granted scopes (`/api/client/granted_scopes/*` APIs) but dynamic scopes are not remembered as granted scopes. **\[7] RESOURCES** Get the value of `resources` from the `/auth/authorization` API response. The array represents the values of the `resource` request parameters. If you want to reject the request, call Authlete's `/auth/authorization/fail` API with `reason=INVALID_TARGET` and use the response from the API to generate a response to the client application. Otherwise, go to the next step (\[ISSUE]). See "Resource Indicators for OAuth 2.0" for details. **\[8] ISSUE** If all the above steps succeeded, the last step is to issue an authorization code, an ID token and/or an access token. (There is a special case, though. In the case of `response_type=none`, nothing is issued.) It can be performed by calling Authlete's `/auth/authorization/issue` API. The API requires the following parameters. Prepare these parameters and call `/auth/authorization/issue` API and use the response to generate a response to the client application. * `ticket` (required) This parameter represents a ticket which is exchanged with tokens at `/auth/authorization/issue`. Use the value of `ticket` contained in the `/auth/authorization` API response. * `subject` (required) This parameter represents the unique identifier of the current end-user. It is often called "user ID" and it may or may not be visible to the user. In any case, it is a number or a string assigned to an end-user by the authorization server implementation. Authlete does not care about the format of the value of subject, but it must consist of only ASCII letters and its length must not exceed 100. When the value of `subject` parameter in the /auth/authorization API response is not `null`, it is necessarily identical to the value of `subject` parameter in the `/auth/authorization/issue` API request. The value of this parameter will be embedded in an ID token as the value of `sub` claim. When the value of `subject_type` configuration parameter of the client application is `PAIRWISE`, the value of sub claim is different from the value specified by this parameter, See [8. Subject Identifier Types](https://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes) of OpenID Connect Core 1.0 for details about subject types. You can use the `sub` request parameter to adjust the value of the `sub` claim in an ID token. See the description of the `sub` request parameter for details. * `authTime` (optional) This parameter represents the time when the end-user authentication occurred. Its value is the number of seconds from `1970-01-01`. The value of this parameter will be embedded in an ID token as the value of `auth_time` claim. * `acr` (optional) This parameter represents the ACR (Authentication Context Class Reference) which the authentication of the end-user satisfies. When `acrs` in the `/auth/authorization` API response is a non-empty array and the value of `acrEssential` is `true`, the value of this parameter must be one of the array elements. Otherwise, even `null` is allowed. The value of this parameter will be embedded in an ID token as the value of `acr` claim. * `claims` (optional) This parameter represents claims of the end-user. "Claims" here are pieces of information about the end-user such as `"name"`, `"email"` and `"birthdate"`. The authorization server implementation is required to gather claims of the end-user, format the claim values into JSON and set the JSON string as the value of this parameter. The claims which the authorization server implementation is required to gather are listed in `claims` parameter in the `/auth/authorization` API response. For example, if claims parameter lists `"name"`, `"email"` and `"birthdate"`, the value of this parameter should look like the following. ```json { "name": "John Smith", "email": "john@example.com", "birthdate": "1974-05-06" } ``` `claimsLocales` parameter in the `/auth/authorization` API response lists the end-user's preferred languages and scripts, ordered by preference. When `claimsLocales` parameter is a non-empty array, its elements should be taken into account when the authorization server implementation gathers claim values. Especially, note the excerpt below from [5.2. Claims Languages and Scripts](https://openid.net/specs/openid-connect-core-1_0.html#ClaimsLanguagesAndScripts) of OpenID Connect Core 1.0. > When the OP determines, either through the `claims_locales` parameter, or by other means, that > the End-User and Client are requesting Claims in only one set of languages and scripts, it is > RECOMMENDED that OPs return Claims without language tags when they employ this language and script. > It is also RECOMMENDED that Clients be written in a manner that they can handle and utilize Claims > using language tags. > If `claims` parameter in the `/auth/authorization` API response is `null` or an empty array, > the value of this parameter should be `null`. > See [5.1. Standard Claims](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) > of OpenID Connect core 1.0 for claim names and their value formats. Note (1) that the authorization > server implementation support its special claims ([5.1.2. Additional Claims](https://openid.net/specs/openid-connect-core-1_0.html#AdditionalClaims)) > and (2) that claim names may be followed by a language tag ([5.2. Claims Languages and Scripts](https://openid.net/specs/openid-connect-core-1_0.html#ClaimsLanguagesAndScripts)). > Read the specification of [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html) > for details. > The claim values in this parameter will be embedded in an ID token. > Note that `idTokenClaims` parameter is available in the `/auth/authorization` API response. > The parameter has the value of the `"id_token"` property in the `claims` request parameter or > in the `"claims"` property in a request object. The value of this parameter should be considered > when you prepare claim values. * `properties` (optional) Extra properties to associate with an access token and/or an authorization code that may be issued by this request. Note that `properties` parameter is accepted only when `Content-Type` of the request is `application/json`, so don't use `application/x-www-form-urlencoded` for details. * `scopes` (optional) Scopes to associate with an access token and/or an authorization code. If this parameter is `null`, the scopes specified in the original authorization request from the client application are used. In other cases, including the case of an empty array, the specified scopes will replace the original scopes contained in the original authorization request. Even scopes that are not included in the original authorization request can be specified. However, as an exception, `openid` scope is ignored on the server side if it is not included in the original request. It is because the existence of `openid` scope considerably changes the validation steps and because adding `openid` triggers generation of an ID token (although the client application has not requested it) and the behavior is a major violation against the specification. If you add `offline_access` scope although it is not included in the original request, keep in mind that the specification requires explicit consent from the user for the scope ([OpenID Connect Core 1.0, 11. Offline Access](https://openid.net/specs/openid-connect-core-1_0.html#OfflineAccess)). When `offline_access` is included in the original request, the current implementation of Authlete's `/auth/authorization` API checks whether the request has come along with `prompt` request parameter and the value includes consent. However, note that the implementation of Authlete's `/auth/authorization/issue` API does not perform such checking if `offline_access` scope is added via this `scopes` parameter. * `sub` (optional) The value of the `sub` claim in an ID token. If the value of this request parameter is not empty, it is used as the value of the `sub` claim. Otherwise, the value of the `subject` request parameter is used as the value of the `sub` claim. The main purpose of this parameter is to hide the actual value of the subject from client applications. Note that even if this `sub` parameter is not empty, the value of the subject request parameter is used as the value of the subject which is associated with the access token. ## INTERACTION When the value of `action` is `INTERACTION`, it means that the request from the client application has no problem and requires the service to process the request with user interaction by an HTML form. The purpose of the UI displayed to the end-user is to ask the end-user to grant authorization to the client application. The items described below are some points which the service implementation should take into account when it builds the UI. **\[1] DISPLAY MODE** The response from `/auth/authorization` API has `display` parameter. It is one of `PAGE` (default), `POPUP`, `TOUCH` and `WAP` The meanings of the values are described in [3.1.2.1. Authentication Request of OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest). Basically, the authorization server implementation should display the UI which is suitable for the display mode, but it is okay for the authorization server implementation to "attempt to detect the capabilities of the User Agent and present an appropriate display". It is ensured that the value of `display` is one of the supported display modes which are specified by `supportedDisplays` configuration parameter of the service. **\[2] UI LOCALE** The response from `/auth/authorization` API has `uiLocales` parameter. It it is not `null`, it lists language tag values (such as `fr-CA`, `ja-JP` and `en`) ordered by preference. The service implementation should display the UI in one of the language listed in the parameter when possible. It is ensured that language tags listed in `uiLocales` are contained in the list of supported UI locales which are specified by `supportedUiLocales` configuration parameter of the service. **\[3] CLIENT INFORMATION** The authorization server implementation should show information about the client application to the end-user. The information is embedded in `client` parameter in the response from `/auth/authorization` API. **\[4] SCOPES** A client application requires authorization for specific permissions. In OAuth 2.0 specification, "scope" is a technical term which represents a permission. `scopes` parameter in the response from `/auth/authorization` API is a list of scopes requested by the client application. The service implementation should show the end-user the scopes. The authorization server implementation may choose not to show scopes to which the end-user has given consent in the past. To put it the other way around, the authorization server implementation may show only the scopes to which the end-user has not given consent yet. However, if the value of `prompts` response parameter contains `CONSENT`, the authorization server implementation has to obtain explicit consent from the end-user even if the end-user has given consent to all the requested scopes in the past. Note that Authlete provides APIs to manage records of granted scopes (`/api/client/granted_scopes/*` APIs), but the APIs work only in the case the Authlete server you use is a dedicated Authlete server (contact [sales@authlete.com](mailto:sales@authlete.com) for details). In other words, the APIs of the shared Authlete server are disabled intentionally (in order to prevent garbage data from being accumulated) and they return 403 Forbidden. It is ensured that the values in `scopes` parameter are contained in the list of supported scopes which are specified by `supportedScopes` configuration parameter of the service. **\[5] DYNAMIC SCOPES** The authorization request may include dynamic scopes. The list of recognized dynamic scopes are accessible by getDynamicScopes() method. See the description of the [DynamicScope](https://authlete.github.io/authlete-java-common/com/authlete/common/dto/DynamicScope.html) class for details about dynamic scopes. **\[6] AUTHORIZATION DETAILS** The authorization server implementation should show the end-user "authorization details" if the request includes it. The value of `authorization_details` parameter in the response is the content of the `authorization_details` request parameter. See "OAuth 2.0 Rich Authorization Requests" for details. **\[7] PURPOSE** The authorization server implementation must show the value of the `purpose` request parameter if it supports [OpenID Connect for Identity Assurance 1.0](https://openid.net/specs/openid-connect-4-identity-assurance-1_0.html). See [8. Transaction-specific Purpose](https://openid.net/specs/openid-connect-4-identity-assurance-1_0.html#rfc.section.8) in the specification for details. Note that the value of `purpose` response parameter is the value of the purpose request parameter. **\[7] END-USER AUTHENTICATION** Necessarily, the end-user must be authenticated (= must login the service) before granting authorization to the client application. Simply put, a login form is expected to be displayed for end-user authentication. The service implementation must follow the steps described below to comply with OpenID Connect. (Or just always show a login form if it's too much of a bother.) * (i) Get the value of `prompts` response parameter. It corresponds to the value of the `prompt` request parameter. Details of the request parameter are described in [3.1.2.1. Authentication Request](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest) of OpenID Connect Core 1.0. * (ii) If the value of `prompts` parameter is `SELECT_ACCOUNT` display a form to let the end-user select on of his/her accounts for login. If `subject` response parameter is not `null`, it is the end-user ID that the client application expects, so the value should be used to determine the value of the login ID. Note that a subject and a login ID are not necessarily equal. If the value of `subject` response parameter is `null`, the value of `loginHint` response parameter should be referred to as a hint to determine the value of the login ID. The value of `loginHint` response parameter is simply the value of the `login_hint` request parameter. * (iii) If the value of `prompts` response parameter contains `LOGIN`, display a form to urge the end-user to login even if the end-user has already logged in. If the value of `subject` response parameter is not `null`, it is the end-user ID that the client application expects, so the value should be used to determine the value of the login ID. Note that a subject and a login ID are not necessarily equal. If the value of `subject` response parameter is `null`, the value of `loginHint` response parameter should be referred to as a hint to determine the value of the login ID. The value of `loginHint` response parameter is simply the value of the `login_hint` request parameter. * (iv) If the value of `prompts` response parameter does not contain `LOGIN`, the authorization server implementation does not have to authenticate the end-user if all the conditions described below are satisfied. If any one of the conditions is not satisfied, show a login form to authenticate the end-user. * An end-user has already logged in the service. * The login ID of the current end-user matches the value of `subject` response parameter. This check is required only when the value of `subject` response parameter is a non-null value. * The max age, which is the number of seconds contained in `maxAge` response parameter, has not passed since the current end-user logged in your service. This check is required only when the value of `maxAge` response parameter is a non-zero value. * If the authorization server implementation does not manage authentication time of end-users (= if the authorization server implementation cannot know when end-users logged in) and if the value of `maxAge` response parameter is a non-zero value, a login form should be displayed. * The ACR (Authentication Context Class Reference) of the authentication performed for the current end-user satisfies one of the ACRs listed in `acrs` response parameter. This check is required only when the value of `acrs` response parameter is a non-empty array. In every case, the end-user authentication must satisfy one of the ACRs listed in `acrs` response parameter when the value of `acrs` response parameter is a non-empty array and `acrEssential` response parameter is `true`. **\[9] GRANT/DENY BUTTONS** The end-user is supposed to choose either (1) to grant authorization to the client application or (2) to deny the authorization request. The UI must have UI components to accept the judgment by the user. Usually, a button to grant authorization and a button to deny the request are provided. When the value of `subject` response parameter is not `null`, the end-user authentication must be performed for the subject, meaning that the authorization server implementation should repeatedly show a login form until the subject is successfully authenticated. The end-user will choose either (1) to grant authorization to the client application or (2) to deny the authorization request. When the end-user chose to deny the authorization request, call Authlete's `/auth/authorization/fail` API with `reason=DENIED` and use the response from the API to generate a response to the client application. When the end-user chose to grant authorization to the client application, the authorization server implementation has to issue an authorization code, an ID token, and/or an access token to the client application. (There is a special case. When `response_type=none`, nothing is issued.) Issuing the tokens can be performed by calling Authlete's `/auth/authorization/issue` API. Read \[ISSUE] written above in the description for the case of `action=NO_INTERACTION`. # Update Ticket Information Source: https://developers.authlete.com/api-reference/authorization-endpoint/update-ticket-information https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/authorization/ticket/update # Backchannel Logout Token Issuing Source: https://developers.authlete.com/api-reference/back-channel-logout/backchannel-logout-token-issuing https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/backchannel/logout/token The `/backchannel/logout/token` API issues a logout token for a client application in the context of [OpenID Connect Back-Channel Logout 1.0](https://openid.net/specs/openid-connect-backchannel-1_0.html). The caller provides a client identifier and either a subject, a session ID, or both. Authlete generates a logout token that the caller should then POST to the client's registered `backchannelLogoutUri`. A response from the `/backchannel/logout/token` API contains an `action` response parameter. The possible values are: ## OK When the action is `OK`, it indicates that the API call completed successfully and a logout token has been issued. The caller should deliver `logoutToken` to `backchannelLogoutUri`. ## SERVER\_ERROR When the action is `SERVER_ERROR`, it indicates that something has gone wrong on the Authlete side. ## CALLER\_ERROR When the action is `CALLER_ERROR`, it indicates that the API call contained a problem. For example, the call may have been missing required request parameters. # Complete Backchannel Authentication Source: https://developers.authlete.com/api-reference/ciba/complete-backchannel-authentication https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/backchannel/authentication/complete This API returns information about what action the authorization server should take after it receives the result of end-user's decision about whether the end-user has approved or rejected a client application's request on the authentication device. After the implementation of the backchannel authentication endpoint returns JSON containing an `auth_req_id` to the client, the authorization server starts a background process that communicates with the authentication device of the end-user. On the authentication device, end-user authentication is performed and the end-user is asked whether they give authorization to the client or not. The authorization server will receive the result of end-user authentication and authorization from the authentication device. After the authorization server receives the result from the authentication device, or even in the case where the server gave up receiving a response from the authentication device for some reasons, the server should call the `/backchannel/authentication/complete` API to tell Authlete the result. When the end-user was authenticated and authorization was granted to the client by the end-user, the authorization server should call the API with `result=AUTHORIZED`. In this successful case, the `subject` request parameter is mandatory. If the token delivery mode is `push`, the API will generate an access token, an ID token and optionally a refresh token. On the other hand, if the token delivery mode is `poll` or `ping`, the API will just update the database record so that `/auth/token` API can generate tokens later. When the authorization server received the decision of the end-user from the authentication device and it indicates that the end-user has rejected to give authorization to the client, the authorization server should call the API with `result=ACCESS_DENIED`. In this case, if the token delivery mode is `push`, the API will generate an error response that contains the error response parameter and optionally the `error_description` and error\_uri response parameters (if the `errorDescription` and `errorUri` request parameters have been given). On the other hand, if the token delivery mode is `poll` or `ping`, the API will just update the database record so that `/auth/token` API can generate an error response later. In any token delivery mode, the value of the error parameter will become `access_denied`. When the authorization server could not get the result of end-user authentication and authorization from the authentication device for some reasons, the authorization server should call the API with `result=TRANSACTION_FAILED`. In this error case, the API will behave in the same way as in the case of `ACCESS_DENIED`. The only difference is that `expired_token` is used as the value of the `error` parameter. The response from `/backchannel/authentication/complete` API has various parameters. Among them, it is `action` parameter that the authorization server implementation should check first because it denotes the next action that the authorization server implementation should take. According to the value of `action`, the service implementation must take the steps described below. ## SERVER\_ERROR When the value of `action` is `SERVER_ERROR`, it means either (1) that the request from the authorization server to Authlete was wrong, or (2) that an error occurred on Authlete side. When the backchannel token delivery mode is `ping` or `push`, `SERVER_ERROR` is used only when an error is detected before the record of the ticket (which is included in the API call to `/backchannel/authentication/complete`) is retrieved from the database successfully. If an error is detected after the record of the ticket is retrieved from the database, `NOTIFICATION` is used instead of `SERVER_ERROR`. When the backchannel token delivery mode is `poll`, `SERVER_ERROR` is used regardless of whether it is before or after the record of the ticket is retrieved from the database. ## NO\_ACTION When the value of `action` is `NO_ACTION`, it means that the authorization server does not have to take any immediate action. `NO_ACTION` is returned when the backchannel token delivery mode is `poll`. In this case, the client will receive the final result at the token endpoint. ## NOTIFICATION When the value of `action` is `NOTIFICATION`, it means that the authorization server must send a notification to the client notification endpoint. According to the CIBA Core specification, the notification is an HTTP POST request whose request body is JSON and whose `Authorization` header contains the client notification token, which was included in the backchannel authentication request as the value of the `client_notification_token` request parameter, as a bearer token. When the backchannel token delivery mode is `ping`, the request body of the notification is JSON which contains the `auth_req_id` property only. When the backchannel token delivery mode is `push`, the request body will additionally contain an access token, an ID token and other properties. Note that when the backchannel token delivery mode is `poll`, a notification does not have to be sent to the client notification endpoint. In error cases, in the ping mode, however, the content of a notification is not different from the content in successful cases. That is, the notification contains the `auth_req_id` property only. The client will know the error when it accesses the token endpoint. On the other hand, in the `push` mode, in error cases, the content of a notification will include the `error` property instead of an access token and an ID token. The client will know the error by detecting that error is included in the notification. In any case, the value of `responseContent` is JSON which can be used as the request body of the notification. The client notification endpoint that the notification should be sent to the value of the `clientNotificationEndpoint` parameter. Likewise, the client notification token that the notification should include as a bearer token is the `clientNotificationToken` parameter. With these methods, the notification can be built like the following. ``` POST {clientNotificationEndpoint} HTTP/1.1 HOST: {The host of clientNotificationEndpoint} Authorization: Bearer {notificationToken} Content-Type: application/json {responseContent} ``` # Fail Backchannel Authentication Request Source: https://developers.authlete.com/api-reference/ciba/fail-backchannel-authentication-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/backchannel/authentication/fail The API prepares JSON that contains an error. The JSON should be used as the response body of the response which is returned to the client from the [backchannel authentication endpoint](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html#auth_backchannel_endpoint). This API is supposed to be called from within the implementation of the [backchannel authentication endpoint](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html#auth_backchannel_endpoint) of the service in order to generate an error response to the client application. The response from `/backchannel/authentication/fails` API has some parameters. Among them, it is `action` parameter that the authorization server 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 (1) the `reason` request parameter of the API call was `SERVER_ERROR`, (2) an error occurred on Authlete side, or (3) the request parameters of the API call were wrong. In this case, the authorization server implementation should return a "500 Internal Server Error" response to the client application. However, in most cases, commercial implementations prefer to use other HTTP status code than 5xx. ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, the authorization server implementation should return a "400 Bad Request" response to the client application. ## FORBIDDEN When the value of `action` is `FORBIDDEN`, it means that the `reason` request parameter of the API call was `ACCESS_DENIED`. In this case, the backchannel authentication endpoint of the authorization server implementation should return a "403 Forbidden" response to the client application. # Issue Backchannel Authentication Response Source: https://developers.authlete.com/api-reference/ciba/issue-backchannel-authentication-response https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/backchannel/authentication/issue This API prepares JSON that contains an `auth_req_id`. The JSON should be used as the response body of the response which is returned to the client from the [backchannel authentication endpoint](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html#auth_backchannel_endpoint) This API is supposed to be called from within the implementation of the backchannel authentication endpoint of the service in order to generate a successful response to the client application. The description of the `/backchannel/authentication` API describes the timing when this API should be called and the meaning of request parameters. See \[AUTH\_REQ\_ID ISSUE] in `USER_IDENTIFICATION`. The response from `/backchannel/authentication/issue` API has some parameters. Among them, it is `action` parameter that the authorization server 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. ```java @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response post(String parameters) { // 'parameters' is the entity body of the backchannel authentication request. ...... } ``` The endpoint implementation does not have to parse the request parameters from the client application because Authlete's `/backchannel/authentication` API does it. The response from `/backchannel/authentication` API has various parameters. Among them, it is `action` parameter that the authorization server implementation should check first because it denotes the next action that the authorization server implementation should take. According to the value of `action`, the service 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" and `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 500 Internal Server Error Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## INVALID\_TICKET When the value of `action` is `INVALID_TICKET`, it means that the ticket included in the API call was invalid. For example, it does not exist or has expired. From a viewpoint of the client application, this is an error on the server side. Therefore, the authorization server implementation should generate a response to the client application with "500 Internal Server Error" and `application/json`. You can build an error response in the same way as shown in the description for the case of `INTERNAL_SERVER_ERROR`. ## OK When the value of `action` is `OK`, it means that Authlete has succeeded in preparing JSON that contains an `auth_req_id`. The JSON should be used as the response body of the response that is returned to the client from the backchannel authentication endpoint. `responseContent` contains the JSON. The following illustrates the response which the authorization server implementation should generate and return to the client application. ``` HTTP/1.1 200 OK Content-Type: text/html;charset=UTF-8 Cache-Control: no-store Pragma: no-cache {responseContent} ``` # Process Backchannel Authentication Request Source: https://developers.authlete.com/api-reference/ciba/process-backchannel-authentication-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/backchannel/authentication This API parses request parameters of a [backchannel authentication request](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html#auth_request) and returns necessary data for the authorization server implementation to process the backchannel authentication request further. This API is supposed to be called from within the implementation of the [backchannel authentication endpoint](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html#auth_backchannel_endpoint) of the service. The endpoint implementation must extract the request parameters from the backchannel authentication request from the client application and pass them as the value of parameters request parameter for Authlete's `/backchannel/authentication` API. The value of parameters is the entire entity body (which is formatted in `application/x-www-form-urlencoded`) of the request from the client application. The following code snippet is an example in JAX-RS showing how to extract request parameters from the backchannel authentication request. ```java @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response post(String parameters) { // 'parameters' is the entity body of the backchannel authentication request. ...... } ``` The endpoint implementation does not have to parse the request parameters from the client application because Authlete's `/backchannel/authentication` API does it. The response from `/backchannel/authentication` API has various parameters. Among them, it is `action` parameter that the authorization server implementation should check first because it denotes the next action that the authorization server implementation should take. According to the value of `action`, the service 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" and `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 500 Internal Server Error Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the request from the client application is invalid. The authorization server implementation should generate a response to the client application with "400 Bad Request" and `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 {responseContent} ``` ## UNAUTHORIZED When the value of `action` is `UNAUTHORIZED`, it means that client authentication of the backchannel authentication request failed. Note that client authentication is always required at the backchannel authentication endpoint. This implies that public clients are not allowed to use the backchannel authentication endpoint. The authorization server implementation should generate a response to the client application with "401 Unauthorized" and `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 must generate and return to the client application. ``` HTTP/1.1 401 Unauthorized WWW-Authenticate: (challenge) Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## USER\_IDENTIFICATION When the value of `action` is `USER_IDENTIFICATION`, it means that the backchannel authentication request from the client application is valid. The authorization server implementation has to follow the steps below. **\[1] END-USER IDENTIFICATION** The first step is to determine the subject (= unique identifier) of the end-user from whom the client application wants to get authorization. According to the CIBA specification, a backchannel authentication request contains one (and only one) of the `login_hint_token`, `id_token_hint` and `login_hint` request parameters as a hint by which the authorization server identifies the subject of an end-user. The authorization server implementation can know which hint is included in the backchannel authentication request by the `hintType` parameter. For example, when the value of the parameter `LOGIN_HINT`, it means that the backchannel authentication request contains the `login_hint` request parameter as a hint. The value of the `hint` parameter is the value of the hint. For example, when the value of the `hintType` parameter is `LOGIN_HINT`, The value of the `hint` parameter is the value of the `login_hint` request parameter. It is up to the authorization server implementation how to determine the subject of the end-user from the hint. Only when the `id_token_hint` request parameter is used, authorization server implementation can use the sub response parameter, which holds the value of the sub claim in the `id_token_hint` request parameter. **\[2] END-USER IDENTIFICATION ERROR** There are some cases where the authorization server implementation encounters an error during the user identification process. In any error case, the service implementation has to return an HTTP response with the error response parameter to the client application. The following is an example of such error responses. ``` HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store Pragma: no-cache { "error":"unknown_user_id" } ``` Authlete provides `/backchannel/authentication/fail` API that builds the response body (JSON) of an error response. However, because it is easy to build an error response manually, you may choose not to call the API. One good thing in using the API is that the API call can trigger deletion of the ticket which has been issued from Authlete's `/backchannel/authentication` API. If you don't call `/backchannel/authentication/fail` API, the ticket will continue to exist in the database until it is cleaned up by the batch program after the ticket expires. Possible error cases that the authorization server implementation itself has to handle are as follows. Other error cases have already been covered by `/backchannel/authentication` API. * `expired_login_hint_token` The authorization server implementation detected that the hint presented by the `login_hint_token` request parameter has expired. Note that the format of `login_hint_token` is not described in the CIBA Core spec at all and so there is no consensus on how to detect expiration of `login_hint_token`. Interpretation of `login_hint_token` is left to each authorization server implementation. * `unknown_user_id` The authorization server implementation could not determine the subject of the end-user by the presented hint. * `unauthorized_client` The authorization server implementation has custom rules to reject backchannel authentication requests from some particular clients and found that the client which has made the backchannel authentication request is one of the particular clients. Note that `/backchannel/authentication` API does not return `action=USER_IDENTIFICATION` in cases where the client does not exist or client authentication has failed. Therefore, the authorization server implementation will never have to use the error code `unauthorized_client` unless the server has intentionally implemented custom rules to reject backchannel authentication requests based on clients. * `missing_user_code` The authorization server implementation has custom rules to require that a backchannel authentication request include a user code for some particular users and found that the user identified by the hint is one of the particular users. Note that `/backchannel/authentication` API does not return `action=USER_IDENTIFICATION` when both the `backchannel_user_code_parameter_supported` metadata of the server and the `backchannel_user_code_parameter` metadata of the client are true and the backchannel authentication request does not include the user\_code request parameter. In this case, `/backchannel/authentication` API returns action=BAD\_REQUEST with JSON containing `"error":"missing_user_code"`. Therefore, the authorization server implementation will never have to use the error code `missing_user_code` unless the server has intentionally implemented custom rules to require a user code based on users even in the case where the `backchannel_user_code_parameter` metadata of the client which has made the backchannel authentication request is `false`. * `invalid_user_code` The authorization server implementation detected that the presented user code is invalid. Note that the format of user\_code is not described in the CIBA Core spec at all and so there is no consensus on how to judge whether a user code is valid or not. It is up to each authorization server implementation how to handle user codes. * `invalid_binding_message` The authorization server implementation detected that the presented binding message is invalid. Note that the format of binding\_message is not described in the CIBA Core spec at all and so there is no consensus on how to judge whether a binding message is valid or not. It is up to each authorization server implementation how to handle binding messages. * `invalid_target` The authorization server implementation rejects the requested target resources. The error code invalid\_target is from "Resource Indicators for OAuth 2.0". The specification defines the resource request parameter. By using the parameter, client applications can request target resources that should be bound to the access token being issued. If the authorization server wants to reject the request, call `/backchannel/authentication/fail` API with `INVALID_TARGET`. * `access_denined` The authorization server implementation has custom rules to reject backchannel authentication requests without asking the end-user and respond to the client as if the end-user had rejected the request in some particular cases and found that the backchannel authentication request is one of the particular cases. The authorization server implementation will never have to use the error code `access_denied` at this timing unless the server has intentionally implemented custom rules to reject backchannel authentication requests without asking the end-user and respond to the client as if the end-user had rejected the request. **\[3] AUTH\_REQ\_ID ISSUE** If the authorization server implementation has successfully determined the subject of the end-user, the next action is to return an HTTP response to the client application which contains `auth_req_id`. Authlete provides `/backchannel/authentication/issue` API which generates a JSON containing `auth_req_id`, so, your next action is (1) call the API, (2) receive the response from the API, (3) build a response to the client application using the content of the API response, and (4) return the response to the client application. See the description of `/backchannel/authentication/issue` API for details. **\[4] END-USER AUTHENTICATION AND AUTHORIZATION** After sending a JSON containing `auth_req_id` back to the client application, the service implementation starts to communicate with an authentication device of the end-user. It is assumed that end-user authentication is performed on the authentication device and the end-user confirms the content of the backchannel authentication request and grants authorization to the client application if everything is okay. The authorization server implementation must be able to receive the result of the end-user authentication and authorization from the authentication device. How to communicate with an authentication device and achieve end-user authentication and authorization is up to each authorization server implementation, but the following request parameters of the backchannel authentication request should be taken into consideration in any implementation. * `acr_values` A backchannel authentication request may contain an array of ACRs (Authentication Context Class References) in preference order. If multiple authentication devices are registered for the end-user, the authorization server implementation should take the ACRs into consideration when selecting the best authentication device. * `scope` A backchannel authentication request always contains a list of scopes. At least, `openid` is included in the list (otherwise `/backchannel/authentication` API returns `action=BAD_REQUEST`). It would be better to show the requested scopes to the end-user on the authentication device or somewhere appropriate. If the scope request parameter contains `address`, `email`, `phone` and/or `profile`, they are interpreted as defined in "5.4. Requesting Claims using Scope Values of OpenID Connect Core 1.0". That is, they are expanded into a list of claim names. The claimNames parameter returns the expanded result. * `binding_message` A backchannel authentication request may contain a binding message. It is a human readable identifier or message intended to be displayed on both the consumption device (client application) and the authentication device. * `user_code` A backchannel authentication request may contain a user code. It is a secret code, such as password or pin, known only to the end-user but verifiable by the authorization server. The user code should be used to authorize sending a request to the authentication device. **\[5] END-USER AUTHENTICATION AND AUTHORIZATION COMPLETION** After receiving the result of end-user authentication and authorization, the authorization server implementation must call Authlete's `/backchannel/authentication/complete` API to tell Authlete the result and pass necessary data so that Authlete can generate an ID token, an access token and optionally a refresh token. See the description of the API for details. **\[6] CLIENT NOTIFICATION** When the backchannel token delivery mode is either `ping` or `push`, the authorization server implementation must send a notification to the pre-registered notification endpoint of the client after the end-user authentication and authorization. In this case, the `action` parameter in a response from `/backchannel/authentication/complete` API is `NOTIFICATION`. See the description of `/backchannel/authentication/complete` API for details. **\[7] TOKEN REQUEST** When the backchannel token delivery mode is either `ping` or `poll`, the client application will make a token request to the token endpoint to get an ID token, an access token and optionally a refresh token. A token request that corresponds to a backchannel authentication request uses `urn:openid:params:grant-type:ciba` as the value of the `grant_type` request parameter. Authlete's `/auth/token` API recognizes the grant type automatically and behaves properly, so the existing token endpoint implementation does not have to be changed to support CIBA. # Create Client Source: https://developers.authlete.com/api-reference/client-management/create-client https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/create Create a new client. # Delete Client Tokens Source: https://developers.authlete.com/api-reference/client-management/delete-client-tokens https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/authorization/delete/{clientId} Delete all existing access tokens issued to a client application by an end-user. The subject parameter is required. # Delete Client Tokens Source: https://developers.authlete.com/api-reference/client-management/delete-client-tokens-1 https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples delete /api/{serviceId}/client/authorization/delete/{clientId} Delete all existing access tokens issued to a client application by an end-user. The subject parameter is required and must be provided as a query parameter. # Delete Client Tokens (by Subject) Source: https://developers.authlete.com/api-reference/client-management/delete-client-tokens-by-subject https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples delete /api/{serviceId}/client/authorization/delete/{clientId}/{subject} Delete all existing access tokens issued to a client application by an end-user. In this variant, the subject is provided in the path. # Delete Client ⚡ Source: https://developers.authlete.com/api-reference/client-management/delete-client-⚡ https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples delete /api/{serviceId}/client/delete/{clientId} Delete a client. # Delete Granted Scopes Source: https://developers.authlete.com/api-reference/client-management/delete-granted-scopes https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples delete /api/{serviceId}/client/granted_scopes/delete/{clientId} Delete the set of scopes that an end-user has granted to a client application. Even if records about granted scopes are deleted by calling this API, existing access tokens are not deleted and scopes of existing access tokens are not changed. The subject parameter is required and must be provided as a query parameter. # Delete Granted Scopes (by Subject) Source: https://developers.authlete.com/api-reference/client-management/delete-granted-scopes-by-subject https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples delete /api/{serviceId}/client/granted_scopes/delete/{clientId}/{subject} Delete the set of scopes that an end-user has granted to a client application. In this variant, the subject is provided in the path. # Delete Requestable Scopes Source: https://developers.authlete.com/api-reference/client-management/delete-requestable-scopes https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples delete /api/{serviceId}/client/extension/requestable_scopes/delete/{clientId} Delete requestable scopes of a client # Get Authorized Applications Source: https://developers.authlete.com/api-reference/client-management/get-authorized-applications https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/client/authorization/get/list Get a list of client applications that an end-user has authorized. The subject parameter is required and can be provided as a query parameter. # Get Authorized Applications Source: https://developers.authlete.com/api-reference/client-management/get-authorized-applications-1 https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/authorization/get/list Get a list of client applications that an end-user has authorized. The subject parameter is required. # Get Authorized Applications (by Subject) Source: https://developers.authlete.com/api-reference/client-management/get-authorized-applications-by-subject https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/client/authorization/get/list/{subject} Get a list of client applications that an end-user has authorized. In this variant, the subject is provided in the path. # Get Client Source: https://developers.authlete.com/api-reference/client-management/get-client https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/client/get/{clientId} Get a client. # Get Granted Scopes Source: https://developers.authlete.com/api-reference/client-management/get-granted-scopes https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/client/granted_scopes/get/{clientId} Get the set of scopes that a user has granted to a client application. Possible values for `requestableScopes` parameter in the response from this API are as follows. ## null The user has not granted authorization to the client application in the past, or records about the combination of the user and the client application have been deleted from Authlete's DB. ## An empty set The user has granted authorization to the client application in the past, but no scopes are associated with the authorization. ## A set with at least one element The user has granted authorization to the client application in the past and some scopes are associated with the authorization. These scopes are returned. Example: `[ "profile", "email" ]` The subject parameter is required and must be provided as a query parameter. # Get Granted Scopes Source: https://developers.authlete.com/api-reference/client-management/get-granted-scopes-1 https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/granted_scopes/get/{clientId} Get the set of scopes that a user has granted to a client application. The subject parameter is required. # Get Granted Scopes (by Subject) Source: https://developers.authlete.com/api-reference/client-management/get-granted-scopes-by-subject https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/client/granted_scopes/get/{clientId}/{subject} Get the set of scopes that a user has granted to a client application. In this variant, the subject is provided in the path. # Get Requestable Scopes Source: https://developers.authlete.com/api-reference/client-management/get-requestable-scopes https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/client/extension/requestable_scopes/get/{clientId} Get the requestable scopes per client # List Clients Source: https://developers.authlete.com/api-reference/client-management/list-clients https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/client/get/list Get a list of clients on a service. If the access token can view a full service (including an admin), all clients within the service are returned. Otherwise, only clients that the access token can view within the service are returned. - ViewClient: [] # Rotate Client Secret Source: https://developers.authlete.com/api-reference/client-management/rotate-client-secret https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/client/secret/refresh/{clientIdentifier} Refresh the client secret of a client. A new value of the client secret will be generated by the Authlete server. If you want to specify a new value, use `/api/client/secret/update` API. # Update Client Source: https://developers.authlete.com/api-reference/client-management/update-client https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/update/{clientId} Update a client. # Update Client Lock Source: https://developers.authlete.com/api-reference/client-management/update-client-lock https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/lock_flag/update/{clientIdentifier} Lock and unlock a client # Update Client Secret Source: https://developers.authlete.com/api-reference/client-management/update-client-secret https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/secret/update/{clientIdentifier} Update the client secret of a client. If you want to have the Authlete server generate a new value of the client secret, use `/api/client/secret/refresh` API. # Update Client Tokens Source: https://developers.authlete.com/api-reference/client-management/update-client-tokens https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/authorization/update/{clientId} Update attributes of all existing access tokens given to a client application. # Update Requestable Scopes Source: https://developers.authlete.com/api-reference/client-management/update-requestable-scopes https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples put /api/{serviceId}/client/extension/requestable_scopes/update/{clientId} Update requestable scopes of a client # Update Requestable Scopes Source: https://developers.authlete.com/api-reference/client-management/update-requestable-scopes-1 https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/extension/requestable_scopes/update/{clientId} Update requestable scopes of a client # Complete Device Authorization Source: https://developers.authlete.com/api-reference/device-flow/complete-device-authorization https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/device/complete This API returns information about what action the authorization server should take after it receives the result of end-user's decision about whether the end-user has approved or rejected a client application's request. In the device flow, an end-user accesses the verification endpoint of the authorization server where she interacts with the verification endpoint and inputs a user code. The verification endpoint checks if the user code is valid and then asks the end-user whether she approves or rejects the authorization request which the user code represents. After the authorization server receives the decision of the end-user, it should call Authlete's `/device/complete` API to tell Authlete the decision. When the end-user was authenticated and authorization was granted to the client by the end-user, the authorization server should call the API with `result=AUTHORIZED`. In this successful case, the subject request parameter is mandatory. The API will update the database record so that `/auth/token` API can generate an access token later. If the `scope` parameter of the device authorization request included the openid scope, an ID token is generated. In this case, `sub`, `authTime`, `acr` and `claims` request parameters in the API call to `/device/complete` affect the ID token. When the authorization server receives the decision of the end-user and it indicates that she has rejected to give authorization to the client, the authorization server should call the API with `result=ACCESS_DENIED`. In this case, the API will update the database record so that the `/auth/token` API can generate an error response later. If `errorDescription` and `errorUri` request parameters are given to the `/device/complete` API, they will be used as the values of `error_description` and `error_uri` response parameters in the error response from the token endpoint. When the authorization server could not get decision from the end-user for some reasons, the authorization server should call the API with `result=TRANSACTION_FAILED`. In this error case, the API will behave in the same way as in the case of `ACCESS_DENIED`. The only difference is that `expired_token` is used as the value of the `error` response parameter instead of `access_denied`. After receiving a response from the `/device/complete` API, the implementation of the authorization server should retrieve the value of `action` from the response and take the following steps according to the value. ## SERVER\_ERROR When the value of `action` is `SERVER_ERROR`, it means that an error occurred on Authlete side. The authorization server implementation should tell the end-user that something wrong happened and urge her to re-initiate a device flow. ## USER\_CODE\_NOT\_EXIST When the value of `action` is `USER_CODE_NOT_EXIST`, it means that the user code included in the API call does not exist. The authorization server implementation should tell the end-user that the user code has been invalidated and urge her to re-initiate a device flow. ## USER\_CODE\_EXPIRED When the value of `action` is `USER_CODE_EXPIRED`, it means that the user code included in the API call has expired. The authorization server implementation should tell the end-user that the user code has expired and urge her to re-initiate a device flow. ## INVALID\_REQUEST When the value of `action` is `INVALID_REQUEST`, it means that the API call is invalid. Probably, the authorization server implementation has some bugs. ## SUCCESS When the value of `action` is `SUCCESS`, it means that the API call has been processed successfully. The authorization server should return a successful response to the web browser the end-user is using. # Process Device Authorization Request Source: https://developers.authlete.com/api-reference/device-flow/process-device-authorization-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/device/authorization This API parses request parameters of a [device authorization request](https://datatracker.ietf.org/doc/html/rfc8628#section-3.1) and returns necessary data for the authorization server implementation to process the device authorization request further. This API is supposed to be called from the within the implementation of the device authorization endpoint of the service. The service implementation should retrieve the value of `action` from the response and take the following steps according to the value. ## INTERNAL\_SERVER\_ERROR When the value of `action` is `INTERNAL_SERVER_ERROR`, it means that the API call from the authorization server implementation was wrong or that an error occurred in Authlete. In either case, from a viewpoint of the client application, it is an error on the server side. Therefore, the authorization server implementation should generate a response to the client application with "500 Internal Server Error"s and `application/json`. The value of `responseContent` is a JSON string which describes t he error, so it can be used as the entity body of the response. *** The following illustrates the response which the authorization server 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 {responseContent} ``` ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the request from the client application is wrong. The authorization server implementation should generate a response to the client application with "400 Bad Request" and `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 {responseContent} ``` ## UNAUTHORIZED When the value of `action` is `UNAUTHORIZED`, it means that client authentication of the device authorization request failed. The authorization server implementation should generate a response to the client application with "401 Unauthorized" and `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 must generate and return to the client application. ``` HTTP/1.1 401 Unauthorized WWW-Authenticate: (challenge) Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## OK When the value of `action` is `OK`, it means that the device authorization request from the client application is valid. The authorization server implementation should generate a response to the client application with "200 OK" and `application/json`. The `responseContent` is a JSON string which can be used as the entity body of the response. *** The following illustrates the response which the authorization server implementation should generate and return to the client application. # Process Device Verification Request Source: https://developers.authlete.com/api-reference/device-flow/process-device-verification-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/device/verification The API returns information associated with a user code. After receiving a response from the device authorization endpoint of the authorization server, the client application shows the end-user the user code and the verification URI which are included in the device authorization response. Then, the end-user will access the verification URI using a web browser on another device (typically, a smart phone). In normal implementations, the verification endpoint will return an HTML page with an input form where the end-user inputs a user code. The authorization server will receive a user code from the form. After receiving a user code, the authorization server should call Authlete's `/device/verification` API with the user code. And then, the authorization server implementation should retrieve the value of `action` parameter from the API response and take the following steps according to the value. ## SERVER\_ERROR When the value of `action` is `SERVER_ERROR`, it means that an error occurred on Authlete side. The authorization server implementation should tell the end-user that something wrong happened and urge her to re-initiate a device flow. ## NOT\_EXIST When the value of `action` is `NOT_EXIST`, it means that the user code does not exist. The authorization server implementation should tell the end-user that the user code is invalid and urge her to retry to input a valid user code. ## EXPIRED When the value of `action` is `EXPIRED`, it means that the user code has expired. The authorization server implementation should tell the end-user that the user code has expired and urge her to re-initiate a device flow. ## VALID When the value of `action` is `VALID`, it means that the user code exists, has not expired, and belongs to the service. The authorization server implementation should interact with the end-user to ask whether she approves or rejects the authorization request from the device. # Delete Client Source: https://developers.authlete.com/api-reference/dynamic-client-registration/delete-client https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/registration/delete Delete a dynamically registered client. This API is supposed to be used to implement a client registration management endpoint that complies with [RFC 7592](https://datatracker.ietf.org/doc/html/rfc7592) (OAuth 2.0 Dynamic Registration Management). This API is supposed to be called from the within the implementation of the client registration management endpoint of the authorization server. The authorization server implementation should retrieve the value of `action` from the response and take the following steps according to the value. ## INTERNAL\_SERVER\_ERROR When the value of `action` is `INTERNAL_SERVER_ERROR`, it means that the API call from the authorization server implementation was wrong or that an error occurred in Authlete. In either case, from a viewpoint of the client or developer, it is an error on the server side. Therefore, the authorization server implementation should generate a response with "500 Internal Server Error"s and `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 authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 500 Internal Server Error Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` The endpoint implementation may return another different response to the client or developer since "500 Internal Server Error" is not required by the specification. ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the request from the client or developer was wrong. The authorization server implementation should generate a response with "400 Bad Request" and `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 authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## UNAUTHORIZED When the value of `action` is `UNAUTHORIZED`, it means that the registration access token used by the client configuration request (RFC 7592) is invalid, or the client application which the token is tied to does not exist any longer or is invalid. The HTTP status of the response returned to the client application must be "401 Unauthorized" 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 endpoint implementation should generate and return to the client application. ``` HTTP/1.1 401 Unauthorized Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` NOTE: The `UNAUTHORIZED` value was added in October, 2021. See the description of `Service.unauthorizedOnClientConfigSupported` for details. ## DELETED When the value of `action` is `DELETED`, it means that the request from the client or developer is valid. The authorization server implementation should generate a response to the client or developer with "204 No Content". *** The following illustrates the response which the authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 204 No Content Cache-Control: no-store Pragma: no-cache ``` # Get Client Source: https://developers.authlete.com/api-reference/dynamic-client-registration/get-client https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/registration/get Get a dynamically registered client. This API is supposed to be used to implement a client registration management endpoint that complies with [RFC 7592](https://datatracker.ietf.org/doc/html/rfc7592) (OAuth 2.0 Dynamic Registration Management). This API is supposed to be called from the within the implementation of the client registration management endpoint of the authorization server. The authorization server implementation should retrieve the value of `action` from the response and take the following steps according to the value. ## INTERNAL\_SERVER\_ERROR When the value of `action` is `INTERNAL_SERVER_ERROR`, it means that the API call from the authorization server implementation was wrong or that an error occurred in Authlete. In either case, from a viewpoint of the client or developer, it is an error on the server side. Therefore, the authorization server implementation should generate a response to the client or developer with "500 Internal Server Error"s and `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 authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 500 Internal Server Error Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` The endpoint implementation may return another different response to the client or developer since "500 Internal Server Error" is not required by the specification. ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the request from the client or developer was wrong. The authorization server implementation should generate a response to the client or developer with "400 Bad Request" and `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 authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## UNAUTHORIZED When the value of `action` is `UNAUTHORIZED`, it means that the registration access token used by the client configuration request (RFC 7592) is invalid, or the client application which the token is tied to does not exist any longer or is invalid. The HTTP status of the response returned to the client application must be "401 Unauthorized" 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 endpoint implementation should generate and return to the client application. ``` HTTP/1.1 401 Unauthorized Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` NOTE: The `UNAUTHORIZED` value was added in October, 2021. See the description of `Service.unauthorizedOnClientConfigSupported` for details. ## OK When the value of `action` is `OK`, it means that the request from the client or developer is valid. The authorization server implementation should generate a response to the client or developer with "200 OK" and `application/json`. The `responseContent` a JSON string which can be used as the entity body of the response. *** The following illustrates the response which the authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 200 OK Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` # Register Client Source: https://developers.authlete.com/api-reference/dynamic-client-registration/register-client https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/registration Register a client. This API is supposed to be used to implement a client registration endpoint that complies with [RFC 7591](https://datatracker.ietf.org/doc/html/rfc7591) (OAuth 2.0 Dynamic Client Registration Protocol). This API is supposed to be called from the within the implementation of the client registration endpoint of the authorization server. The authorization server implementation should retrieve the value of `action` from the response and take the following steps according to the value. ## INTERNAL\_SERVER\_ERROR When the value of `action` is `INTERNAL_SERVER_ERROR`, it means that the API call from the authorization server implementation was wrong or that an error occurred in Authlete. In either case, from a viewpoint of the client or developer, it is an error on the server side. Therefore, the authorization server implementation should generate a response with "500 Internal Server Error"s and `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 authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 500 Internal Server Error Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` The endpoint implementation may return another different response to the client or developer since "500 Internal Server Error" is not required by the specification. ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the request from the client or developer was wrong. The authorization server implementation should generate a response with "400 Bad Request" and `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 authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## CREATED When the value of `action` is `CREATED`, it means that the request from the client or developer is valid. The authorization server implementation should generate a response to the client or developer with "201 CREATED" and `application/json`. The `responseContent` a JSON string which can be used as the entity body of the response. *** The following illustrates the response which the authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 201 CREATED Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` # Update Client Source: https://developers.authlete.com/api-reference/dynamic-client-registration/update-client https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/client/registration/update Update a dynamically registered client. This API is supposed to be used to implement a client registration management endpoint that complies with [RFC 7592](https://datatracker.ietf.org/doc/html/rfc7592) (OAuth 2.0 Dynamic Registration Management). This API is supposed to be called from the within the implementation of the client registration management endpoint of the authorization server. The authorization server implementation should retrieve the value of `action` from the response and take the following steps according to the value. ## INTERNAL\_SERVER\_ERROR When the value of `action` is `INTERNAL_SERVER_ERROR`, it means that the API call from the authorization server implementation was wrong or that an error occurred in Authlete. In either case, from a viewpoint of the client or developer, it is an error on the server side. Therefore, the authorization server implementation should generate a response with "500 Internal Server Error"s and `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 authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 500 Internal Server Error Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` The endpoint implementation may return another different response to the client or developer since "500 Internal Server Error" is not required by the specification. ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the request from the client or developer was wrong. The authorization server implementation should generate a response with "400 Bad Request" and `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 authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## UNAUTHORIZED When the value of `action` is `UNAUTHORIZED`, it means that the registration access token used by the client configuration request (RFC 7592) is invalid, or the client application which the token is tied to does not exist any longer or is invalid. The HTTP status of the response returned to the client application must be "401 Unauthorized" 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 endpoint implementation should generate and return to the client application. ``` HTTP/1.1 401 Unauthorized Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` NOTE: The `UNAUTHORIZED` value was added in October, 2021. See the description of `Service.unauthorizedOnClientConfigSupported` for details. ## UPDATED When the value of `action` is `UPDATED`, it means that the request from the client or developer is valid. The authorization server implementation should generate a response to the client or developer with "200 OK" and `application/json`. The `responseContent` a JSON string which can be used as the entity body of the response. *** The following illustrates the response which the authorization server implementation should generate and return to the client or developer. ``` HTTP/1.1 200 OK Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` # Process Entity Configuration Request Source: https://developers.authlete.com/api-reference/federation-endpoint/process-entity-configuration-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/federation/configuration This API gathers the federation configuration about a service. The authorization server implementation should retrieve the value of the `action` response parameter from the API response and take the following steps according to the value. ### `OK` When the value of the `action` response parameter is `OK`, it means that Authlete could prepare an entity configuration successfully. In this case, the implementation of the entity configuration endpoint of the authorization server should return an HTTP response to the client application with the HTTP status code "`200 OK`" and the content type "`application/entity-statement+jwt`". The message body (= an entity configuration in the JWT format) of the response has been prepared by Authlete's `/federation/configuration` API and it is available as the `responseContent` response parameter. The implementation of the entity configuration endpoint can construct an HTTP response by doing like below. ``` 200 OK Content-Type: application/entity-statement+jwt (Other HTTP headers) (the value of the responseContent response parameter) ``` ### `NOT_FOUND` When the value of the `action` response parameter is `NOT_FOUND`, it means that the service configuration has not enabled the feature of [OpenID Connect Federation 1.0](https://openid.net/specs/openid-connect-federation-1_0.html) and so the client application should have not access the entity configuration endpoint. In this case, the implementation of the entity configuration endpoint of the authorization server should return an HTTP response to the client application with the HTTP status code "`404 Not Found`" and the content type "`application/json`". The message body (= error information in the JSON format) of the response has been prepared by Authlete's `/federation/configuration` API and it is available as the `responseContent` response parameter. The implementation of the entity configuration endpoint can construct an HTTP response by doing like below. ``` 404 Not Found Content-Type: application/json (Other HTTP headers) (the value of the responseContent response parameter) ``` ### `INTERNAL_SERVER_ERROR` could prepare an entity configuration successfully. In this case, the implementation of the entity configuration endpoint of the authorization server should return an HTTP response to the client application with the HTTP status code "`200 OK`" and the content type "`application/entity-statement+jwt`". The message body (= an entity configuration in the JWT format) of the response has been prepared by Authlete's `/federation/configuration` API and it is available as the `responseContent` response parameter. The implementation of the entity configuration endpoint can construct an HTTP response by doing like below. ``` 200 OK Content-Type: application/entity-statement+jwt (Other HTTP headers) (the value of the responseContent response parameter) ``` # Process Federation Registration Request Source: https://developers.authlete.com/api-reference/federation-endpoint/process-federation-registration-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/federation/registration The Authlete API is for implementations of the **federation registration endpoint** that accepts "explicit client registration". Its details are defined in [OpenID Connect Federation 1.0](https://openid.net/specs/openid-connect-federation-1_0.html). The endpoint accepts `POST` requests whose `Content-Type` is either of the following. 1. `application/entity-statement+jwt`- `application/trust-chain+json` When the `Content-Type` of a request is `application/entity-statement+jwt`, the content of the request is the entity configuration of a relying party that is to be registered. In this case, the implementation of the federation registration endpoint should call Authlete's `/federation/registration` API with the entity configuration set to the `entityConfiguration` request parameter. On the other hand, when the `Content-Type` of a request is `application/trust-chain+json`, the content of the request is a JSON array that contains entity statements in JWT format. The sequence of the entity statements composes the trust chain of a relying party that is to be registered. In this case, the implementation of the federation registration endpoint should call Authlete's `/federation/registration` API with the trust chain set to the `trustChain` request parameter. # Process Grant Management Request Source: https://developers.authlete.com/api-reference/grant-management-endpoint/process-grant-management-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/gm The API is for the implementation of the grant management endpoint which is defined in "[Grant Management for OAuth 2.0](https://openid.net/specs/fapi-grant-management.html)". # Create Security Key Source: https://developers.authlete.com/api-reference/hardware-security-key/create-security-key https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/hsk/create # Delete Security Key Source: https://developers.authlete.com/api-reference/hardware-security-key/delete-security-key https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples delete /api/{serviceId}/hsk/delete/{handle} # Get Security Key Source: https://developers.authlete.com/api-reference/hardware-security-key/get-security-key https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/hsk/get/{handle} # List Security Keys Source: https://developers.authlete.com/api-reference/hardware-security-key/list-security-keys https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/hsk/get/list # Process Introspection Request Source: https://developers.authlete.com/api-reference/introspection-endpoint/process-introspection-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/introspection This API gathers information about an access token. This API is supposed to be called from within the implementations of protected resource endpoints of the authorization server implementation in order to get information about the access token which was presented by the client application. In general, a client application accesses a protected resource endpoint of a service with an access token, and the implementation of the endpoint checks whether the presented access token has enough privileges (= scopes) to access the protected resource before returning the protected resource to the client application. To achieve this flow, the endpoint implementation has to know detailed information about the access token. Authlete `/auth/introspection` API can be used to get such information. The response from `/auth/introspection` API has some parameters. Among them, it is `action` parameter that the authorization server 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 string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage), so if the protected resource of the service implementation wants to return an error response to the client application in the way that complies with RFC 6750 (in other words, if `accessTokenType` configuration parameter of the service is Bearer), the value of `responseContent` can be used as the value of `WWW-Authenticate` header. The following is an example response which complies with RFC 6750. ``` HTTP/1.1 500 Internal Server Error Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the request from the client application does not contain an access token (= the request from the authorization server implementation to Authlete does not contain `token` request parameter). 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 string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage), so if the protected resource of the service implementation wants to return an error response to the client application in the way that complies with RFC 6750 (in other words, if `accessTokenType` configuration parameter of the service is `Bearer`), the value of `responseContent` can be used as the value of `WWW-Authenticate` header. The following is an example response which complies with RFC 6750. ``` HTTP/1.1 400 Bad Request WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## UNAUTHORIZED When the value of `action` is `UNAUTHORIZED`, it means that the access token does not exist or has expired. The value of `responseContent` is a string which describes the error in the format of RFC 6750 (OAuth 2.0 Bearer Token Usage), so if the protected resource of the service implementation wants to return an error response to the client application in the way that complies with [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (in other words, if `accessTokenType` configuration parameter of the service is `Bearer`), the value of `responseContent` can be used as the value of `WWW-Authenticate` header. The following is an example response which complies with RFC 6750. ``` HTTP/1.1 401 Unauthorized WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## FORBIDDEN When the value of `action` is `FORBIDDEN`, it means that the access token does not cover the required scopes or that the subject associated with the access token is different from the subject contained in the request. 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 string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage), so if the protected resource of the service implementation wants to return an error response to the client application in the way that complies with RFC 6750 (in other words, if `accessTokenType` configuration parameter of the service is Bearer), the value of `responseContent` can be used as the value of `WWW-Authenticate` header. The following is an example response which complies with RFC 6750. ``` HTTP/1.1 403 Forbidden WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## OK When the value of `action` is `OK`, it means that the access token which the client application presented is valid (= exists and has not expired). The implementation of the protected resource endpoint is supposed to return the protected resource to the client application. When action is `OK`, the value of `responseContent` is `"Bearer error=\"invalid_request\""`. This is the simplest string which can be used as the value of `WWW-Authenticate` header to indicate "400 Bad Request". The implementation of the protected resource endpoint may use this string to tell the client application that the request was bad (e.g. in case necessary request parameters for the protected resource endpoint are missing). However, in such a case, the implementation should generate a more informative error message to help developers of client applications. The following is an example error response which complies with RFC 6750. ``` HTTP/1.1 400 Bad Request WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` Basically, The value of `responseContent` is a string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage). So, if the service has selected `Bearer` as the value of `accessTokenType` configuration parameter, the value of `responseContent` can be used directly as the value of `WWW-Authenticate` header. However, if the service has selected another different token type, the service has to generate error messages for itself. ***JWT-based access token*** Since version 2.1, Authlete provides a feature to issue access tokens in JWT format. This feature can be enabled by setting a non-null value to the `accessTokenSignAlg` property of the service (see the description of the Service class for details). `/api/auth/introspection` API can accept access tokens in JWT format. However, note that the API does not return information contained in a given JWT-based access token but returns information stored in the database record which corresponds to the given JWT-based access token. Because attributes of the database record can be modified after the access token is issued (for example, by using `/api/auth/token/update` API), information returned by `/api/auth/introspection` API and information the given JWT-based access token holds may be different. # Process OAuth 2.0 Introspection Request Source: https://developers.authlete.com/api-reference/introspection-endpoint/process-oauth-20-introspection-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/introspection/standard This API exists to help your authorization server provide its own introspection API which complies with [RFC 7662](https://tools.ietf.org/html/rfc7662) (OAuth 2.0 Token Introspection). This API is supposed to be called from within the implementations of the introspection endpoint of your service. The authorization server implementation should retrieve the value of `action` from the response and take the following steps according to the value. In general, a client application accesses a protected resource endpoint of a service with an access token, and the implementation of the endpoint checks whether the presented access token has enough privileges (= scopes) to access the protected resource before returning the protected resource to the client application. To achieve this flow, the endpoint implementation has to know detailed information about the access token. Authlete `/auth/introspection` API can be used to get such information. The response from `/auth/introspection` API has some parameters. Among them, it is `action` parameter that the authorization server 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". The value of `responseContent` is a JSON string which describes the error, so it can be used as the entity body of the response if you want. Note that, however, [RFC 7662](https://datatracker.ietf.org/doc/html/rfc7662) does not mention anything about the response body of error responses. *** The following illustrates an example response which the introspection endpoint of the authorization server implementation generates and returns to the client application. ``` HTTP/1.1 500 Internal Server Error Content-Type: application/json {responseContent} ``` ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the request from the client application is invalid. This happens when the request from the client did not include the token request parameter. See "[2.1. Introspection Request](https://datatracker.ietf.org/doc/html/rfc7662#section-2.1)" in RFC 7662 for details about requirements for introspection requests. The HTTP status of the response returned to the client application should be "400 Bad Request". The value of `responseContent` is a JSON string which describes the error, so it can be used as the entity body of the response if you want. Note that, however, [RFC 7662](https://datatracker.ietf.org/doc/html/rfc7662) does not mention anything about the response body of error responses. The following illustrates an example response which the introspection endpoint of the authorization server implementation generates and returns to the client application. ``` HTTP/1.1 400 Bad Request Content-Type: application/json {responseContent} ``` ## OK When the value of `action` is `OK`, the request from the client application is valid. The HTTP status of the response returned to the client application must be "200 OK" and its content type must be `application/json`. The value of `responseContent` is a JSON string which complies with the introspection response defined in "2.2. Introspection Response" in RFC7662. *** The following illustrates the response which the introspection endpoint of your authorization server implementation should generate and return to the client application. ``` HTTP/1.1 200 OK Content-Type: application/json {responseContent} ``` Note that RFC 7662 says *"To prevent token scanning attacks, **the endpoint MUST also require some form of authorization to access this endpoint**"*. This means that you have to protect your introspection endpoint in some way or other. Authlete does not care about how your introspection endpoint is protected. In most cases, as mentioned in RFC 7662, "401 Unauthorized" is a proper response when an introspection request does not satisfy authorization requirements imposed by your introspection endpoint. # Process Pushed Authorization Request Source: https://developers.authlete.com/api-reference/pushed-authorization-endpoint/process-pushed-authorization-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/pushed_auth_req This API creates a pushed request authorization. It authenticates the client and creates a authorization_uri to be returned by the authorization server. # Process Revocation Request Source: https://developers.authlete.com/api-reference/revocation-endpoint/process-revocation-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/revocation This API revokes access tokens and refresh tokens. This API is supposed to be called from within the implementation of the revocation endpoint ([RFC 7009](tools.ietf.org/html/rfc7009)) of the authorization server implementation in order to revoke access tokens and refresh tokens. The response from `/auth/revocation` API has some parameters. Among them, it is `action` parameter that the authorization server 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". 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 {responseContent} ``` ## 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". The description about `invalid_client` shown below is an excerpt from [RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749). *** 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 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 {responseContent} ``` ``` HTTP/1.1 401 Unauthorized WWW-Authenticate: {challenge} Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the request from the client application is invalid. The HTTP status of the response returned to the client application must be "400 Bad Request" and the content type must be `application/json`. [RFC 7009](https://datatracker.ietf.org/doc/html/rfc7009), [2.2.1. Error Respons](https://datatracker.ietf.org/doc/html/rfc7009#section-2.2.1) states "The error presentation conforms to the definition in [Section 5.2](https://datatracker.ietf.org/doc/html/rfc6749#section-5.2) of \[[RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749)]." 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 authorization server 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 {responseContent} ``` ## OK When the value of `action` is `OK`, it means that the request from the client application is valid and the presented token has been revoked successfully or if the client submitted an invalid token. Note that invalid tokens do not cause an error. See [2.2. Revocation Response](https://datatracker.ietf.org/doc/html/rfc7009#section-2.2) for details. The HTTP status of the response returned to the client application must be 200 OK. If the original request from the client application contains callback request parameter and its value is not empty, the content type should be `application/javascript` and the content should be a JavaScript snippet for JSONP. The value of `responseContent` is JavaScript snippet if the original request from the client application contains callback request parameter and its value is not empty. Otherwise, the value of `responseContent` is `null`. ``` HTTP/1.1 200 OK Content-Type: application/javascript Cache-Control: no-store Pragma: no-cache {responseContent} ``` # Create Service (IDP) Source: https://developers.authlete.com/api-reference/service-management/create-service-idp https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/service Create a new service on the API server, belonging to the specified organization. A service can be created with an organization token or by a user with the CREATE_SERVICE role. This endpoint is hosted on the Authlete IdP server (`https://login.authlete.com`), not on the regional API clusters. # Get Service Source: https://developers.authlete.com/api-reference/service-management/get-service https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/service/get Get a service. If the access token can only view or modify clients underneath this service, but does not have access to view this service directly, a limited view of the service will be returned. # Get Service Configuration Source: https://developers.authlete.com/api-reference/service-management/get-service-configuration https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/service/configuration This API gathers configuration information about a service. This API is supposed to be called from within the implementation of the configuration endpoint of the service where the service that supports OpenID Connect and [OpenID Connect Discovery 1.0](https://openid.net/specs/openid-connect-discovery-1_0.html) must expose its configuration information in a JSON format. Details about the format are described in "[3. OpenID Provider Metadata](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata)" in OpenID Connect Discovery 1.0. # List Services Source: https://developers.authlete.com/api-reference/service-management/list-services https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/service/get/list Get a list of services. If the access token can only view or modify clients underneath a service, but does not have access to view that service directly, a limited view of the service will be returned. Otherwise, all properties of the service are returned. If the access token is an administrative token, this returns a list of all services on the Authlete instance. Otherwise, all services that the access token can view, even in a limited fashion, are returned. # Remove Service (IDP) ⚡ Source: https://developers.authlete.com/api-reference/service-management/remove-service-idp-⚡ https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/service/remove Delete a service from the API server. A service can be deleted with an organization token or by a user with the MODIFY_SERVICE role. This endpoint is hosted on the Authlete IdP server (`https://login.authlete.com`), not on the regional API clusters. # Update Service Source: https://developers.authlete.com/api-reference/service-management/update-service https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/service/update Update a service. # Fail Token Request Source: https://developers.authlete.com/api-reference/token-endpoint/fail-token-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/token/fail This API generates a content of an error token response that the authorization server implementation returns to the client application. This API is supposed to be called from within the implementation of the token endpoint of the service in order to generate an error response to the client application. The description of the `/auth/token` API describes the timing when this API should be called. See the description for the case of `action=PASSWORD`. The response from `/auth/token/fail` API has some parameters. Among them, it is `action` parameter that the authorization server 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". 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 {responseContent} ``` The endpoint implementation may return another different response to the client application since "500 Internal Server Error" is not required by OAuth 2.0. ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that Authlete's `/auth/token/fail` API successfully generated an error response for the client application. The HTTP status of the response returned to the client application must be "400 Bad Request" 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 {responseContent} ``` # Issue Token Response Source: https://developers.authlete.com/api-reference/token-endpoint/issue-token-response https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/token/issue This API generates a content of a successful token response that the authorization server implementation returns to the client application. This API is supposed to be called from within the implementation of the token endpoint of the service in order to generate a successful response to the client application. The description of the `/auth/token` API describes the timing when this API should be called. See the description for the case of `action=PASSWORD`. The response from `/auth/token/issue` API has some parameters. Among them, it is `action` parameter that the authorization server 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". 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 {responseContent} ``` The endpoint implementation may return another different response to the client application since "500 Internal Server Error" is not required by OAuth 2.0. ## OK When the value of `action` is `OK`, it means that Authlete's `/auth/token/issue` API successfully generated an access token. 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, 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 {responseContent} ``` # Process Token Request Source: https://developers.authlete.com/api-reference/token-endpoint/process-token-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/token This API parses request parameters of an authorization request and returns necessary data for the authorization server implementation to process the authorization request further. 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) { // 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); } ``` **Note**: The `jwtAtClaims` request parameter is effective only when this API directly issues an access token, i.e., in the `client_credentials` grant flow (and the Native SSO branch of Token Exchange). For other grant flows, additional JWT claims must be set via the corresponding API instead: `/auth/authorization/issue` (authorization\_code), `/auth/backchannel/authentication/complete` (CIBA), or `/auth/device/complete` (device\_code). `jwtAtClaims` is silently ignored when sent with other grants. 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 {responseContent} ``` 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 {responseContent} ``` ``` HTTP/1.1 401 Unauthorized WWW-Authenticate: {challenge} Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ## 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 {responseContent} ``` ## 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, \{@link #getUsername()} returns the value of `"username"` request parameter and \{@link #getPassword()} returns the value of \{@code "password"} 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} 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 \{@link #getTicket()} method as the value for `"ticket"` parameter. 2. The response from `/auth/token/issue` API (\{@link TokenIssueResponse}) 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 \{@code /auth/token/fail} API with `reason=`\{@link TokenFailRequest.Reason#INVALID\_RESOURCE\_OWNER\_CREDENTIALS INVALID\_RESOURCE\_OWNER\_CREDENTIALS} to generate an error response for the client application. The API requires `"ticket"` request parameter. Use the value returned from \{@link #getTicket()} method as the value for `"ticket"` parameter. 4. The response from `/auth/token/fail` API (\{@link TokenFailResponse}) 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 {responseContent} ``` ## 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](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 \{@link Service#isTokenExchangeEncryptedJwtRejected() tokenExchangeEncryptedJwtRejected} 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 \{ @code "urn:ietf:params:oauth:token-type:jwt" }. 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. 5. Check if the JWT is signed and if it is not signed, then (a) reject the token exchange request when the \{@link Service#isTokenExchangeUnsignedJwtRejected() tokenExchangeUnsignedJwtRejected} 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`\* 6. 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`. 7. Confirm that the access token has not expired. 8. Confirm that the access token belongs to the service. \*Token Type: `urn:ietf:params:oauth:token-type:refresh_token`\* 9. 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`. 10. Confirm that the refresh token has not expired. 11. Confirm that the refresh token belongs to the service. \*Token Type: `urn:ietf:params:oauth:token-type:id_token`\* 12. Confirm that the format conforms to the JWT specification ([RFC 7519](https://www.rfc-editor.org/rfc/rfc7519.html)). 13. Check if the ID Token is encrypted and if it is encrypted, then (a) reject the token exchange request when the \{@link Service#isTokenExchangeEncryptedJwtRejected() tokenExchangeEncryptedJwtRejected} 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"`. 14. Confirm that the ID Token contains the `exp` claim and the current time has not reached the time indicated by the claim. 15. Confirm that the ID Token contains the `iat` claim and the current time is equal to or after the time indicated by the claim. 16. Confirm that the current time is equal to or after the time indicated by the `nbf` claim if the ID Token contains the claim. 17. 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. 18. Confirm that the ID Token contains the `aud` claim and its value is a JSON string or an array of JSON strings. 19. Confirm that the value of the `nonce` claim is a JSON string if the ID Token contains the claim. 20. Check if the ID Token is signed and if it is not signed, then (a) reject the token exchange request when the \{@link Service#isTokenExchangeUnsignedJwtRejected() tokenExchangeUnsignedJwtRejected} flag of the service is `true` or (b) finish validation on the input token. 21. 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`. 22. 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 \{@link Action#TOKEN\_EXCHANGE TOKEN\_EXCHANGE}, the \{@link \#getResponseContent()} 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: {challenge} Content-Type: application/json Cache-Control: no-store Pragma: no-cache {responseContent} ``` ``` HTTP/1.1 200 OK Content-Type: application/json Cache-Control: no-cache, no-store { "access_token": "{@link TokenCreateResponse#getAccessToken()}", "issued_token_type": "urn:ietf:params:oauth:token-type:access_token", "token_type": "Bearer", "expires_in": { @link TokenCreateResponse#getExpiresIn() }, "scope": "String.join(" ", {@link TokenCreateResponse#getScopes()})" } ``` ## 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 \{@link Service#isJwtGrantEncryptedJwtRejected() jwtGrantEncryptedJwtRejected} 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. \{@link Service#getIssuer()}) or the URL of the token endpoint (cf. \{@link Service#getTokenEndpoint()}) 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 \{@link Service#isJwtGrantUnsignedJwtRejected() jwtGrantUnsignedJwtRejected} 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 { "access_token": "{@link TokenCreateResponse#getAccessToken()}", "token_type": "Bearer", "expires_in": {@link TokenCreateResponse#getExpiresIn()}, "scope": "String.join(" ", {@link TokenCreateResponse#getScopes()})" } ``` 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. # Reissue ID Token Source: https://developers.authlete.com/api-reference/token-endpoint/reissue-id-token https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/idtoken/reissue The API is expected to be called only when the value of the `action` parameter in a response from the `/auth/token` API is [ID_TOKEN_REISSUABLE](https://authlete.github.io/authlete-java-common/com/authlete/common/dto/TokenResponse.Action.html#ID_TOKEN_REISSUABLE). The purpose of the `/idtoken/reissue` API is to generate a token response that includes a new ID token together with a new access token and a refresh token. # Create Access Token Source: https://developers.authlete.com/api-reference/token-operations/create-access-token https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/token/create Create an access token. # Delete Access Token Source: https://developers.authlete.com/api-reference/token-operations/delete-access-token https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples delete /api/{serviceId}/auth/token/delete/{accessTokenIdentifier} Delete an access token. # List Issued Tokens Source: https://developers.authlete.com/api-reference/token-operations/list-issued-tokens https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples get /api/{serviceId}/auth/token/get/list Get the list of access tokens that are associated with the service. # Revoke Access Token Source: https://developers.authlete.com/api-reference/token-operations/revoke-access-token https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/token/revoke Revoke an access token. Bulk revocation with `clientIdentifier` only, `clientIdentifier` + `subject`, or `subject` only deletes at most **20 tokens per request** (the default of `token.revoke.count.max` in `ServerConfiguration.java`). If the target has more than 20 tokens, the response `count` will be 20 and the remainder is left untouched. To fully wipe them, call the endpoint repeatedly until `count` returns 0. ### Safe bulk revocation under ongoing service: the lock-then-revoke pattern When you call `/auth/token/revoke` repeatedly with `clientIdentifier` to wipe all tokens for a client that is still serving live traffic, the following problems arise: * Each call deletes at most 20 tokens, so a loop is required. * During the loop the client can keep issuing and refreshing tokens, so the loop may not converge, or it may collateral-delete legitimate tokens issued after the revocation started. * For a public client whose refresh token has leaked (no `client_secret` to rotate), the attacker can keep refreshing while the cleanup runs. The safe and reliable pattern is to **temporarily lock the client first, then revoke**. 1. Call `POST /api/client/lock_flag/update/{clientIdentifier}` with `clientLocked: true`. * All subsequent token-endpoint calls for this client (`authorization_code`, `refresh_token`, `client_credentials`, etc.) are rejected with `invalid_client` (e.g. `A458101`). * Existing tokens are also rejected by `/auth/introspection` with `invalid_token` (`A097303`: "The client application associated with the presented access token is locked."). * This immediately stops the attacker's refresh path — including the public-client RT-leak case where there is no `client_secret` to rotate. 2. Call `POST /api/auth/token/revoke` with `clientIdentifier` in a loop until the response `count` reaches 0. * Because issuance is stopped, the loop converges deterministically. * All existing tokens are physically deleted, eliminating any leftover leaked tokens. 3. Call `POST /api/client/lock_flag/update/{clientIdentifier}` with `clientLocked: false` to return to normal operation. * End users re-authenticate and receive fresh tokens. # Update Access Token Source: https://developers.authlete.com/api-reference/token-operations/update-access-token https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/token/update Update an access token. # Issue UserInfo Response Source: https://developers.authlete.com/api-reference/userinfo-endpoint/issue-userinfo-response https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/userinfo/issue This API generates an ID token. This API is supposed to be called from within the implementation of the [userinfo endpoint](https://openid.net/specs/openid-connect-core-1_0.html#UserInfo) of the authorization server in order to generate an ID token. Before calling this API, a valid response from `/auth/userinfo` API must be obtained. Then, call this API with the access token contained in the response and the claims values of the user (subject) associated with the access token. See **OK** written in the description of `/auth/userinfo` API for details. The response from `/auth/userinfo/issue` API has various parameters. Among them, it is `action` parameter that the authorization server implementation should check first because it denotes the next action that the authorization server implementation should take. According to the value of `action`, the service 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". The parameter `responseContent` returns a string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage) so the userinfo endpoint implementation can use the value of `responseContent` as the value of`WWW-Authenticate` header. The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from userinfo endpoint comply with RFC 6750. See [5.3.3. UserInfo Response](https://openid.net/specs/openid-connect-core-1_0.html#UserInfoError) for details. ``` HTTP/1.1 500 Internal Server Error WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the request from the client application does not contain an access token (= the request from the authorization server implementation to Authlete does not contain `token` parameter). The parameter `responseContent` returns a string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage) so the userinfo endpoint implementation can use the value of `responseContent` as the value of`WWW-Authenticate` header. The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from userinfo endpoint comply with RFC 6750. See [5.3.3. UserInfo Response](https://openid.net/specs/openid-connect-core-1_0.html#UserInfoError) for details. ``` HTTP/1.1 400 Bad Request WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## UNAUTHORIZED When the value of `action` is `UNAUTHORIZED`, it means that the access token does not exist, has expired, or is not associated with any subject (= any user account). The parameter `responseContent` returns a string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage) so the userinfo endpoint implementation can use the value of `responseContent` as the value of`WWW-Authenticate` header. The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from userinfo endpoint comply with RFC 6750. See [5.3.3. UserInfo Response](https://openid.net/specs/openid-connect-core-1_0.html#UserInfoError) for details. ``` HTTP/1.1 401 Unauthorized WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## FORBIDDEN When the value of `action` is `FORBIDDEN`, it means that the access token does not include the `openid` scope. The parameter `responseContent` returns a string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage) so the userinfo endpoint implementation can use the value of `responseContent` as the value of`WWW-Authenticate` header. The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from userinfo endpoint comply with RFC 6750. See [5.3.3. UserInfo Response](https://openid.net/specs/openid-connect-core-1_0.html#UserInfoError) for details. ``` HTTP/1.1 403 Forbidden WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## JSON When the value of `action` is `JSON`, it means that the access token which the client application presented is valid and an ID token was successfully generated in the format of JSON. The userinfo endpoint implementation is expected to generate a response to the client application. The content type of the response must be `application/json` and the response body must be an ID token in JSON format. The value of `responseContent` is the ID token in JSON format when `action` is `JSON`, so a response to the client can be built like below. ``` HTTP/1.1 200 OK Cache-Control: no-store Pragma: no-cache Content-Type: application/json;charset=UTF-8 {responseContent} ``` ## JWT When the value of `action` is `JWT`, it means that the access token which the client application presented is valid and an ID token was successfully generated in the format of JWT (JSON Web Token) ([RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519)). The userinfo endpoint implementation is expected to generate a response to the client application. The content type of the response must be `application/jwt` and the response body must be an ID token in JWT format. The value of `responseContent` is the ID token in JSON format when `action` is `JWT`, so a response to the client can be built like below. ``` HTTP/1.1 200 OK Cache-Control: no-store Pragma: no-cache Content-Type: application/jwt {responseContent} ``` # Process UserInfo Request Source: https://developers.authlete.com/api-reference/userinfo-endpoint/process-userinfo-request https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/userinfo This API gathers information about a user. This API is supposed to be called from within the implementation of the [userinfo endpoint](https://openid.net/specs/openid-connect-core-1_0.html#UserInfo) of the authorization server in order to get information about the user that is associated with an access token. The response from `/auth/userinfo` API has various parameters. Among them, it is `action` parameter that the authorization server implementation should check first because it denotes the next action that the authorization server implementation should take. According to the value of `action`, the service 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". The value of `responseContent` is a string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage) so the userinfo endpoint implementation can use the value of `responseContent` as the value of`WWW-Authenticate` header. The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from userinfo endpoint comply with RFC 6750. See [5.3.3. UserInfo Response](https://openid.net/specs/openid-connect-core-1_0.html#UserInfoError) for details. ``` HTTP/1.1 500 Internal Server Error WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## BAD\_REQUEST When the value of `action` is `BAD_REQUEST`, it means that the request from the client application does not contain an access token (= the request from the authorization server implementation to Authlete does not contain `token` parameter). The value of `responseContent` is a string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage) so the userinfo endpoint implementation can use the value of `responseContent` as the value of`WWW-Authenticate` header. The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from userinfo endpoint comply with RFC 6750. See [5.3.3. UserInfo Response](https://openid.net/specs/openid-connect-core-1_0.html#UserInfoError) for details. ``` HTTP/1.1 400 Bad Request WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## UNAUTHORIZED When the value of `action` is `UNAUTHORIZED`, it means that the access token does not exist, has expired, or is not associated with any subject (= any user account). The value of `responseContent` is a string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage) so the userinfo endpoint implementation can use the value of `responseContent` as the value of`WWW-Authenticate` header. The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from userinfo endpoint comply with RFC 6750. See [5.3.3. UserInfo Response](https://openid.net/specs/openid-connect-core-1_0.html#UserInfoError) for details. ``` HTTP/1.1 401 Unauthorized WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## FORBIDDEN When the value of `action` is `FORBIDDEN`, it means that the access token does not include the `openid` scope. The value of `responseContent` is a string which describes the error in the format of [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage) so the userinfo endpoint implementation can use the value of `responseContent` as the value of`WWW-Authenticate` header. The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from userinfo endpoint comply with RFC 6750. See [5.3.3. UserInfo Response](https://openid.net/specs/openid-connect-core-1_0.html#UserInfoError) for details. ``` HTTP/1.1 403 Forbidden WWW-Authenticate: {responseContent} Cache-Control: no-store Pragma: no-cache ``` ## OK When the value of `action` is `OK`, it means that the access token which the client application presented is valid. To be concrete, it means that the access token exists, has not expired, includes the openid scope, and is associated with a subject (= a user account). What the userinfo endpoint implementation should do next is to collect information about the subject (user) from your database. The value of the `subject` is contained in the subject parameter in the response from this API and the names of data, i.e., the claims names are contained in the claims parameter in the response. For example, if the `subject` parameter is `joe123` and the claims parameter is `[ "given_name", "email" ]`, you need to extract information about joe123's given name and email from your database. Then, call Authlete's `/auth/userinfo/issue` API with the collected information and the access token in order to make Authlete generate an ID token. If an error occurred during the above steps, generate an error response to the client. The response should comply with [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750). For example, if the subject associated with the access token does not exist in your database any longer, you may feel like generating a response like below. ``` HTTP/1.1 400 Bad Request WWW-Authenticate: Bearer error="invalid_token", error_description="The subject associated with the access token does not exist." Cache-Control: no-store Pragma: no-cache ``` Also, an error might occur on database access. If you treat the error as an internal server error, then the response would be like the following. ``` HTTP/1.1 500 Internal Server Error WWW-Authenticate: Bearer error="server_error", error_description="Failed to extract information about the subject from the database." Cache-Control: no-store Pragma: no-cache ``` # Get JSON Web Key Set Source: https://developers.authlete.com/api-reference/verifiable-credential-issuer/get-json-web-key-set https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/vci/jwks Get JSON Web Key Set for VCI # Get JWT Issuer Information Source: https://developers.authlete.com/api-reference/verifiable-credential-issuer/get-jwt-issuer-information https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/vci/jwtissuer Get JWT issuer information for VCI # Get Verifiable Credential Issuer Metadata Source: https://developers.authlete.com/api-reference/verifiable-credential-issuer/get-verifiable-credential-issuer-metadata https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/vci/metadata Get verifiable credential issuer metadata # Action Handling Source: https://developers.authlete.com/get-started/concepts/action-handling How to branch on the action field in Core API responses and map each action to the HTTP response your authorization server returns. Most Core API responses include an `action` field. The principle of implementing an authorization server with Authlete is simple: call a Core API, parse the response, check the value of `action`, and process accordingly. You **NEVER** use the value of `resultCode` as a condition of processing. Each Core API defines its own set of actions, but the values fall into two patterns — actions that map directly to an HTTP response to the client, and actions that require a second Authlete API call: ```mermaid theme={null} flowchart TD Start(["Response from a Core API"]) --> D{"action"} D -->|"Direct response (e.g. LOCATION)"| L["HTTP response
built from responseContent"] D -->|"Two-step call (e.g. INTERACTION)"| Work["Server-side work
(e.g. authenticate user)"] Work --> Next["Call the next Authlete API"] Next -.->|response carries another action| D ``` This page walks through the actions of the [/auth/authorization](/api-reference/authorization-endpoint/process-authorization-request) API to show how the model works, then introduces **representative** actions you will encounter in other Core APIs — the lists on this page are not exhaustive, so always consult the API reference of the API you are calling. ## Actions of /auth/authorization A response from the [/auth/authorization](/api-reference/authorization-endpoint/process-authorization-request) API contains one of the following values in the `action` field: | Action | Meaning | What your server does (example) | | - | - | - | | `INTERACTION` | The authorization request is valid and user interaction is required. | Continue with a second API call — see [Two-Step API Calls](/get-started/concepts/two-step-api-calls). | | `NO_INTERACTION` | The request is valid and requires no user interaction (e.g. `prompt=none`). | Continue with a second API call — see [Two-Step API Calls](/get-started/concepts/two-step-api-calls). | | `LOCATION` | A redirect response should be returned. | Return `302 Found` with `responseContent` as the `Location` header. | | `FORM` | A form-post response should be returned. | Return `200 OK` with `responseContent` (an HTML form) as the body. | | `BAD_REQUEST` | The authorization request is invalid. | Return `400 Bad Request` with `responseContent` as the body. | | `INTERNAL_SERVER_ERROR` | An error occurred on the Authlete side or the request to Authlete was malformed. | Return `500 Internal Server Error` with `responseContent` as the body. | Besides `action`, the response also carries the information your authorization server needs to build the authentication and consent page — such as the client's display information and the requested scopes and claims. See the [API Reference](/api-reference/authorization-endpoint/process-authorization-request) for the full response schema. ## Mapping Actions to HTTP Responses Most actions correspond one-to-one to an HTTP response your server returns to the client, built from `responseContent`. For example, when the response from the Authlete Core API contains `action` of `BAD_REQUEST`, your authorization server returns a response like the following to the client: ``` HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store Pragma: no-cache (responseContent) ``` And when `action` is `LOCATION`: ``` HTTP/1.1 302 Found Location: (responseContent) Cache-Control: no-store Pragma: no-cache ``` ## Actions That Need More Steps `INTERACTION` and `NO_INTERACTION` — along with grant-processing actions such as `PASSWORD`, `TOKEN_EXCHANGE`, and `JWT_BEARER` — cannot be completed by returning a single HTTP response. Your server needs to do its own work, such as authenticating the user and obtaining consent, and then call a second Authlete API to finish the processing. This pattern is explained in [Two-Step API Calls](/get-started/concepts/two-step-api-calls). ## Representative Actions in Other APIs Other Core APIs follow the same convention with their own action sets. The following are representative actions — not an exhaustive list: | Action | Examples of APIs | What your server does (example) | | - | - | - | | `OK` | [/auth/introspection](/api-reference/introspection-endpoint/process-introspection-request), [/auth/userinfo](/api-reference/userinfo-endpoint/process-userinfo-request), many others | The request was processed successfully. Typically return `200 OK` with `responseContent`, or proceed to the next step (for `/auth/userinfo`, gather claim values and call [/auth/userinfo/issue](/api-reference/userinfo-endpoint/issue-userinfo-response)). | | `CREATED` | [/client/registration](/api-reference/client-management/create-client) | A resource was created (e.g. dynamic client registration). Return `201 Created` with `responseContent`. | | `UNAUTHORIZED` | [/auth/userinfo](/api-reference/userinfo-endpoint/process-userinfo-request), [/auth/introspection](/api-reference/introspection-endpoint/process-introspection-request) | The presented token is invalid. Return `401 Unauthorized` with `responseContent` as the `WWW-Authenticate` header. | | `INVALID_CLIENT` | [/auth/token](/api-reference/token-endpoint/process-token-request), [/auth/revocation](/api-reference/revocation-endpoint/process-revocation-request) | Client authentication failed. Return `400` or `401` as described in the API reference. | | `FORBIDDEN` | [/auth/introspection](/api-reference/introspection-endpoint/process-introspection-request), [/auth/userinfo](/api-reference/userinfo-endpoint/process-userinfo-request) | The access token is valid but lacks the scopes (or resources) required for the request. Return `403 Forbidden`. | | `NOT_FOUND` | [/gm](/api-reference/grant-management-endpoint/process-grant-management-request) | The target resource does not exist (e.g. the `grant_id` specified in a Grant Management request). Return `404 Not Found`. | | `PASSWORD`, `TOKEN_EXCHANGE`, `JWT_BEARER` | [/auth/token](/api-reference/token-endpoint/process-token-request) | Your server must perform its own validation (user credentials, subject token, assertion) before deciding to issue tokens — see [Two-Step API Calls](/get-started/concepts/two-step-api-calls). | Newer APIs (e.g. `/vci/*`, `/gm`) distinguish where an error originates: `CALLER_ERROR` means the request from your implementation is wrong, while `AUTHLETE_ERROR` indicates an error inside Authlete. # API Authentication Source: https://developers.authlete.com/get-started/concepts/authentication How to authenticate with Authlete APIs: bearer tokens, Service Access Tokens, and Organization Access Tokens, and how to obtain them. This page is for Authlete 3.0. For 2.x, see [API Authentication (2.x)](/v2/get-started/quickstarts/authentication) — 2.x uses API key and API secret (HTTP Basic auth) rather than Bearer tokens. # API Authentication All API endpoints are secured using **Bearer token** authentication. You must include an access token in every request: ```http theme={null} Authorization: Bearer YOUR_ACCESS_TOKEN ``` Authlete supports two types of access tokens: **Service Access Token** (scoped to a single service) and **Organization Token** (scoped to your entire organization). The sections below explain how to get each and when to use them. *** ## Getting your access token ### Service Access Token Scoped to a **single service** (one authorization server instance). Use it for the [Core API](/get-started/concepts/request-and-response) (authorization, token, introspection) and for managing that service’s clients and settings. **How to get a Service Access Token** 1. Log in to the [Authlete Console](https://console.authlete.com/). 2. Open the **Organization** that owns the service, then open the **Service** to view its **Service Overview**. 3. Click **Service Settings** (next to **Create Client**). Service Overview page in the Authlete Console, with the Service Settings button highlighted 4. On the **General** tab, scroll to **Service Access Tokens**, then click **Create Token**. Service Access Tokens section on the General tab, with the Create Token button and a token list showing a Permissions column 5. In the dialog, set a **token name** and choose permissions — either a preset (Authorization Server for `use_service`, Resource Server for `use_introspection`, …) or individual permissions. See [Permissions](#permissions) below. Add a Service Access Token dialog, showing the token name field and permission presets such as Authorization Server (use_service) and Resource Server (use_introspection) 6. Click **Create Token** to generate it, then **copy the token immediately** — it is shown only once. Store it in a secure place (e.g. environment variables or a secret manager). Use this token in the `Authorization: Bearer ` header when calling Authlete APIs for that service. *** ### Organization Token Scoped to your **entire organization**. An Organization Token carries the broadest access: with the right permissions it can call any API on **any service** in the organization — including the Core API — plus organization-level operations such as creating services and reading the organization audit log. It is typically used for organization-wide management and for automation that spans multiple services (e.g. CI/CD, Terraform). **How to get an Organization Token** 1. Log in to the [Authlete Console](https://console.authlete.com/). 2. Open the **Organization** you want a token for (or create one first). 3. In the sidebar, open **Organization Settings**. 4. On the **General** tab, scroll to **Organization Access Tokens**, then click **Create Token**. Organization Access Tokens section on the General tab, with the Create Token button and a token list showing a Permissions column 5. In the dialog, set a **token name** and choose the org-level permissions you need — for example the **Administrator** preset (`create_service`, `modify_service`, `view_audit_log`) for CI/CD provisioning, or `view_audit_log` for read-only audit access. See [Permissions](#permissions) below. Add an Organization Access Token dialog, showing the token name field and organization-level permission presets such as Administrator and Audit Reader 6. Click **Create Token** to generate it, then **copy the token immediately** — it is shown only once. Store it securely. Use this token in the `Authorization: Bearer ` header when calling Authlete APIs that require organization-level access. *** **Important:** Tokens inherit the permissions of the account that creates them. **Service tokens** can only access their specific service. **Organization tokens** can access all services within your organization. Choose the token type and permissions that match what your application needs. *** ## Which token to use Based on the principle of **least privilege**, here is the recommended token type for each use case — pick the narrowest one that covers the job: | Use case | Token type | | - | - | | Core API (authorization, token, introspection) | **Service Access Token** | | Managing a single service (clients, endpoints, config) | **Service Access Token** | | Managing the organization or multiple services | **Organization Token** | | Automation / CI/CD that creates or updates services | **Organization Token** | For Core API calls, prefer a Service Access Token: it confines access to a single service, whereas an Organization Token would expose every service if it leaked. Reach for an Organization Token when the work genuinely spans multiple services or needs organization-level operations. *** ## Permissions Whichever token type you choose, the token carries **fine-grained permissions** that decide which Authlete APIs it can call — for example `use_service` for an authorization server that calls the Core API, `use_introspection` for a resource server, or `create_client` for provisioning. You pick these when you create the token, so grant only what the workload needs (**least privilege**). For the full list of permissions and the APIs each one allows, see [Service Access Tokens](/deployment-and-operations/access-control/service-access-tokens) in the developer guide. *** ## Token security best practices * **Never commit tokens to version control** — Store them in environment variables or a secure secret manager (e.g. AWS Secrets Manager, HashiCorp Vault). * **Rotate regularly** — Generate new tokens periodically and revoke old ones from the console. * **Scope appropriately** — Request only the permissions your application needs when creating a token. * **Revoke unused tokens** — Delete tokens you are no longer using from the console. *** ## Quick test Verify your token works with a simple API call: ```bash theme={null} curl -X GET "https://us.authlete.com/api/service/get/list" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` Use a **Service Access Token** for service-scoped endpoints or an **Organization Token** for org-scoped endpoints. Replace `us.authlete.com` with your cluster host (e.g. `eu.authlete.com`, `jp.authlete.com`) if you use a different region. *** ## Next steps * [Getting Started](/get-started/quickstarts/getting-started) — Create an account, organization, and service. * [Using Demo Authorization Server](/get-started/quickstarts/using-demo-authorization-server) — Create a service, generate a Service Access Token, and run a demo authorization server. * [OAuth 2.0 Basics](/get-started/quickstarts/oauth-2-0-basics) — A tutorial on how an authorization server leverages Authlete APIs. # Client Management Source: https://developers.authlete.com/get-started/concepts/client-management Registering and managing client applications with the Management API: client CRUD operations, the management console, and dynamic client registration. A **client** represents an application that requests authorization from your service. The Management API provides CRUD operations for clients, so you can register and maintain them programmatically — for example from your own developer portal or provisioning pipeline. ## Client Management APIs | API | Purpose | | - | - | | [/client/create](/api-reference/client-management/create-client) | Register a new client. | | [/client/get](/api-reference/client-management/get-client) | Retrieve a client's settings. | | [/client/get/list](/api-reference/client-management/list-clients) | List clients registered in the service. | | [/client/update](/api-reference/client-management/update-client) | Update a client's settings. | You can also manage clients interactively in the [Authlete Management Console](https://console.authlete.com), which uses these APIs under the hood. ## End-User Grants per Client Authlete records which client applications each end-user has authorized. The Management API exposes this relationship so you can build a "manage your authorized apps" screen: * [/client/authorization/get/list](/api-reference/client-management/get-authorized-applications) — list the client applications an end-user has authorized * [/client/authorization/update](/api-reference/client-management/update-client-tokens) — update the attributes (e.g. scopes) of the access tokens issued to a client for an end-user * [/client/authorization/delete](/api-reference/client-management/delete-client-tokens) — delete all access tokens issued to a client for an end-user See [Authlete's Policy on Managing Clients Which Have Been Authorized by User](/configuration-reference/client-management/authletes-policy-on-managing-clients-which-have-been-authorized-by-user) for the underlying model. ## Related Concepts * [Using Client ID Alias](/v2/configuration-reference/client-management/client-id-alias) — assigning an arbitrary client ID in Authlete 2.x * [Client Attributes](/configuration-reference/client-management/client-attributes) — attaching arbitrary key-value metadata to clients ## Next Steps * [Token Management](/get-started/concepts/token-management) — operating on tokens issued to clients * [Service Management](/get-started/concepts/service-management) — the service that clients belong to # Management API Overview Source: https://developers.authlete.com/get-started/concepts/overview What the Management API is for: configuring services, managing clients, and operating issued tokens — out-of-band from the OAuth/OIDC protocol flows handled by the Core API. The **Management API** is the group of Authlete APIs that manage the configuration of your authorization server and the entities inside it — services, clients, and tokens. Unlike the [Core API](/get-started/concepts/request-and-response), which handles OAuth 2.0 / OpenID Connect protocol requests at runtime, the Management API is used out-of-band to set up and operate the authorization server. ## Typical Use Cases * **Provisioning** — Create and configure services from infrastructure-as-code pipelines, replicate environments across production, staging, and development. * **Client lifecycle** — Register new client applications from your developer portal or admin tools, rotate secrets, deactivate clients. * **Token administration** — List access tokens issued for an end-user or client, revoke tokens when a device is lost or abuse is reported, migrate tokens from a legacy authorization server. * **End-user authorization screens** — Show the list of applications an end-user has authorized, and let them revoke individual clients. * **Operations and audit** — Inspect issued tokens, adjust expiration policies, audit which clients exist. ## Authentication Management API calls require a **Service Access Token** with the permissions appropriate for each operation. See [Authentication](/get-started/concepts/authentication) for how to create a token and assign permissions. Service creation and deletion are exceptions: they live on the **IdP Endpoint** and require an **Organization Token**. See [Service Management](/get-started/concepts/service-management). ## Management API and the Management Console The [Authlete Management Console](https://console.authlete.com) is built on top of the Management API. The operations you can perform in the console — creating services, registering clients, viewing tokens — are exposed through the same APIs, so you can choose whichever fits your workflow: * Interactive changes by humans → use the console. * Repeatable, automated, or auditable changes → use the Management API directly. ## Next Steps * [Service Management](/get-started/concepts/service-management) — service-level settings and lifecycle. * [Client Management](/get-started/concepts/client-management) — registering and operating client applications. * [Token Management](/get-started/concepts/token-management) — administrative operations on issued tokens. # Request and Response Source: https://developers.authlete.com/get-started/concepts/request-and-response The common request and response structure of Authlete's Core API: passing client request parameters as-is and interpreting resultCode, action, and responseContent. The **Core API** is the group of Authlete APIs that process OAuth 2.0 and OpenID Connect protocol requests, such as [/auth/authorization](/api-reference/authorization-endpoint/process-authorization-request), [/auth/token](/api-reference/token-endpoint/process-token-request), and [/auth/userinfo](/api-reference/userinfo-endpoint/process-userinfo-request). Your authorization server receives requests from client applications at its endpoints and delegates the protocol processing to these APIs. This page explains the request and response structure shared by the Core APIs. ```mermaid theme={null} sequenceDiagram autonumber participant C as Client Application participant AS as Authorization Server participant API as Authlete Core API C ->> AS: Protocol request (e.g. authorization request) Note over AS: Pass parameters as-is AS ->> API: POST /auth/... (JSON body) API -->> AS: resultCode, action, responseContent, ... Note over AS: Branch on action AS -->> C: HTTP response built from responseContent ``` ## Request Format Core APIs accept an HTTP POST request with a JSON body. Authenticate with a Service Access Token in the `Authorization` header: ```bash theme={null} curl -s -X POST https://us.authlete.com/api/{Service ID}/auth/authorization \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "parameters": "response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb%2Fexample.com" }' ``` Replace `us.authlete.com` with your cluster host (e.g. `eu.authlete.com`, `jp.authlete.com`) if you use a different region. See [Authentication](/get-started/concepts/authentication) for how to obtain a Service Access Token. ### Main Request Parameters The exact set of request parameters differs per API and depends on which OAuth/OIDC specifications your service supports, so it cannot be fully generalized — always check the [API Reference](/api-reference) of the API you are calling. That said, the following parameters appear across many Core APIs: | Parameter | Description | | - | - | | `parameters` | The request your endpoint received from the client, passed as-is: the query string for the authorization endpoint, or the `application/x-www-form-urlencoded` request body for the token endpoint. | | `clientId` | The client ID. When the client authenticates with `client_secret_basic`, extract it from the `Authorization: Basic` header of the request to your token endpoint. | | `clientSecret` | The client secret, extracted from the `Authorization: Basic` header in the same way. | | `clientCertificate` | The client certificate from the mutual TLS connection. Required when supporting mTLS client authentication or certificate-bound access tokens ([RFC 8705](https://www.rfc-editor.org/rfc/rfc8705)). | | `ticket` | The ticket returned by the first API of a two-step call (e.g. [/auth/authorization](/api-reference/authorization-endpoint/process-authorization-request)), passed to the second API (e.g. [/auth/authorization/issue](/api-reference/authorization-endpoint/issue-authorization-response)). See [Two-Step API Calls](/get-started/concepts/two-step-api-calls). | | `token` | The access token to inspect, for APIs such as [/auth/introspection](/api-reference/introspection-endpoint/process-introspection-request) and [/auth/userinfo](/api-reference/userinfo-endpoint/process-userinfo-request). | | `subject` | The unique identifier of the end-user your server has authenticated, passed to issuing APIs such as [/auth/authorization/issue](/api-reference/authorization-endpoint/issue-authorization-response). | Supporting additional specifications adds parameters accordingly — for example, DPoP ([RFC 9449](https://www.rfc-editor.org/rfc/rfc9449)) adds `dpop`, `htm`, and `htu` to token and introspection requests. ## Pass Client Request Parameters As-Is Your authorization server is expected to pass the parameters it receives at its authorization endpoint and token endpoint to the corresponding Authlete APIs **as-is — you usually MUST NOT modify or pre-process them**. For example, if you want to check the values of the `scope` parameter in an authorization request, you don't have to verify them before invoking the [/auth/authorization](/api-reference/authorization-endpoint/process-authorization-request) API. Instead, include the whole query string as the value of the `parameters` field. Authlete verifies the request and returns the validated scope values in its response, which your authorization server can then use safely. Implementing your own verification or modification before invoking [/auth/authorization](/api-reference/authorization-endpoint/process-authorization-request) or [/auth/token](/api-reference/token-endpoint/process-token-request) is risky. You might bypass Authlete's protocol handling and error checking, and in the worst case your authorization server could become non-compliant with OAuth 2.0 / OpenID Connect. ## Response Format Core API responses share the following fields: | Field | Description | | - | - | | `resultCode` | A code identifying the processing result (e.g. `A004001`). Useful for logging and troubleshooting. | | `resultMessage` | A human-readable description of the result. | | `action` | The next step your server should take. **This is the field your implementation must branch on.** | | `responseContent` | Content to use when building the response to the client, such as a JSON body or a redirect URI with error parameters. | The `action` field is the heart of the Core API programming model: it tells your authorization server what kind of HTTP response to return to the client, or which Authlete API to call next. See [Action Handling](/get-started/concepts/action-handling) for details. Never branch your processing on `resultCode`. Result codes are diagnostic information; the contract for what to do next is expressed solely by `action`. # Service Management Source: https://developers.authlete.com/get-started/concepts/service-management Managing services — authorization server instances — with the Management API: service CRUD operations, configuration retrieval, and the management console. A **service** represents one authorization server instance. All settings that define your authorization server's behavior — supported grant types, token expiration, signing keys, endpoint configuration, and so on — belong to a service. Clients and tokens always live inside a service. ## Service Management APIs Service retrieval, listing, and updates are served on the Authlete API host: | API | Purpose | | - | - | | [/service/get](/api-reference/service-management/get-service) | Retrieve a service's settings. | | [/service/get/list](/api-reference/service-management/list-services) | List services you can access. | | [/service/update](/api-reference/service-management/update-service) | Update a service's settings. | Day-to-day configuration is usually done in the [Authlete Management Console](https://console.authlete.com); the APIs are useful for automation such as infrastructure-as-code pipelines and environment replication. [/service/update](/api-reference/service-management/update-service) replaces the whole service configuration with the request body. Retrieve the current settings with [/service/get](/api-reference/service-management/get-service) first, modify only the fields you need, and send the complete object back. ### Creating and deleting services (IdP Endpoint) Service creation and deletion live on a **separate host — the IdP Endpoint** — and require an **Organization Token**. On Shared Cloud the IdP host is `login.authlete.com`. | Operation | Endpoint (Shared Cloud) | | - | - | | Create a service | `POST https://login.authlete.com/api/service` | | Delete a service | `POST https://login.authlete.com/api/service/remove` | On Dedicated Cloud and Self-Managed (on-premises) deployments, replace `login.authlete.com` with the IdP host of your environment. Calling service creation directly against the Authlete API host creates the service but does not link it to your organization — the service will not appear in the Console and cannot be operated with Organization Tokens. Always use the IdP Endpoint for creation and deletion. ## What a Service Defines Service settings cover, among others: * Supported grant types, response types, and scopes * Token settings — formats and expiration of access tokens, refresh tokens, and ID tokens * Endpoint URLs published in the discovery document * Keys for signing and encryption (JWK Set) For a walk-through of the individual settings, see [Service Management Guide](/configuration-reference/service-settings/service-management). ## Next Steps * [Client Management](/get-started/concepts/client-management) — registering clients in your service * [Token Management](/get-started/concepts/token-management) — operating on tokens issued by your service # Token Management Source: https://developers.authlete.com/get-started/concepts/token-management Managing issued access tokens and refresh tokens outside the protocol flows: listing, creating, updating, and revoking tokens with the Management API. While the Core API issues and validates tokens as part of OAuth/OIDC protocol flows, the **Management API** lets you operate on issued tokens directly — outside the flows. Typical use cases include building an administration screen, revoking tokens when a user reports a stolen device, or migrating tokens from an existing authorization server. ## Token Operation APIs | API | Purpose | | - | - | | [/auth/token/get/list](/api-reference/token-operations/list-issued-tokens) | List issued tokens. You can filter by client and end-user (subject). | | [/auth/token/create](/api-reference/token-operations/create-access-token) | Create an access token without going through an authorization flow. Useful for migration or testing. | | [/auth/token/update](/api-reference/token-operations/update-access-token) | Update properties of an issued token, such as its expiration date and scopes. | | [/auth/token/revoke](/api-reference/token-operations/revoke-access-token) | Revoke tokens. You can revoke by token identifier, or revoke all tokens of a client or an end-user at once. | | [/auth/token/delete](/api-reference/token-operations/delete-access-token) | Delete a token entry itself from the database. | Revocation initiated by a *client application* (RFC 7009) is part of the protocol flows and is handled by the Core API [/auth/revocation](/api-reference/revocation-endpoint/process-revocation-request). The token operation APIs above are for *administrative* operations performed by your server or back-office tools. ## Relation to Client and Service Lifecycle Token lifecycle is tied to the entities that issued them: * Deleting a client affects its issued tokens. See [Token Management Policy When Deleting Clients](/configuration-reference/client-management/token-management-policy-when-deleting-clients). * Authlete tracks which clients an end-user has authorized, which you can manage per user. See [Authlete's Policy on Managing Clients Which Have Been Authorized by User](/configuration-reference/client-management/authletes-policy-on-managing-clients-which-have-been-authorized-by-user). ## Next Steps * [Client Management](/get-started/concepts/client-management) — managing the clients that tokens are issued to * [Service Management](/get-started/concepts/service-management) — service-level settings such as token expiration defaults # Two-Step API Calls Source: https://developers.authlete.com/get-started/concepts/two-step-api-calls How actions such as INTERACTION are completed with a second API call — /auth/authorization/issue or /auth/authorization/fail — linked by a ticket. Some actions cannot be completed in a single API call. When the [/auth/authorization](/api-reference/authorization-endpoint/process-authorization-request) API returns `action=INTERACTION`, your authorization server must authenticate the user and obtain consent before the authorization request can be answered — and that answer is produced by a **second** Authlete API call. ## Two Types of Authorization Endpoint APIs The [Authorization Endpoint APIs](/api-reference/authorization-endpoint) consist of two types: 1. An API that interprets the authorization request and provides the information needed for the next step, such as end-user authentication: * [/auth/authorization](/api-reference/authorization-endpoint/process-authorization-request) 2. APIs that issue tokens or codes, or return errors: * [/auth/authorization/issue](/api-reference/authorization-endpoint/issue-authorization-response), [/auth/authorization/fail](/api-reference/authorization-endpoint/fail-authorization-request) The typical flow for `action=INTERACTION` looks like this: ```mermaid theme={null} sequenceDiagram autonumber participant UA as Web Browser participant AS as Authorization Server participant API as Authlete Core API UA ->> AS: Authorization request AS ->> API: POST /auth/authorization API -->> AS: action=INTERACTION, ticket AS ->> UA: Authentication and consent page UA ->> AS: User authenticates and consents AS ->> API: POST /auth/authorization/issue (ticket) API -->> AS: action=LOCATION, responseContent AS ->> UA: 302 Found (authorization code) ``` ## Flow Steps ### The Authorization Request and the First Call An OAuth 2.0 / OpenID Connect flow begins when a client redirects the end-user's browser to your authorization server's authorization endpoint. The request sent at that point — a query string containing `response_type`, `client_id`, `redirect_uri`, `scope`, and so on — is the "Authorization request" in the diagram above. Your server passes the request through to [/auth/authorization](/api-reference/authorization-endpoint/process-authorization-request) unmodified (see [Request and Response](/get-started/concepts/request-and-response) for details). When the authorization request requires interaction with the end-user, Authlete returns a response like this: ```json theme={null} { "action": "INTERACTION", "ticket": "cElOaH9j4mS6AiIGR9oLqHlDn9jpvcNjqSgyRqfcmAE", "client": { "..." }, "service": { "..." } } ``` * `action=INTERACTION` means the end-user must be involved — authenticated and asked for consent — before the authorization request can be answered. * `ticket` carries the processing over to the second call (see [The Ticket](#the-ticket) below for its properties). * The response also carries client and service information, along with the scopes and claims the client requested. Your server uses these to build the consent screen. ### Presenting the Authentication and Consent Screen **Rendering the authentication/consent screen, authenticating the user, and obtaining consent are all your authorization server's responsibility** — Authlete does not render these screens. Your server uses the information from the first response to present the consent screen. Meanwhile, hold the `ticket` on the server side (for example, in the session) until the second call. ### The Second Call and Building the Authorization Response Once the user has authenticated and consented, your server makes the second call to [/auth/authorization/issue](/api-reference/authorization-endpoint/issue-authorization-response). This request includes the `ticket` received in the first call and the `subject` — the identifier of the authenticated end-user. ```bash theme={null} curl -s -X POST https://us.authlete.com/api/{Service ID}/auth/authorization/issue \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "ticket": "{the ticket from the first response}", "subject": "{the authenticated end-user identifier}" }' ``` If you use a different region, replace `us.authlete.com` with your cluster host (e.g. `eu.authlete.com`, `jp.authlete.com`). See [Authentication](/get-started/concepts/authentication) for how to obtain a Service Access Token. When issuing an OpenID Connect ID token, you can also pass `authTime` (the time the user was authenticated), `acr` (the authentication context class), the requested claim values, and more. See the [/auth/authorization/issue](/api-reference/authorization-endpoint/issue-authorization-response) API reference for the full list of parameters. On success, the response `action` is typically `LOCATION`, and `responseContent` holds the redirect URL containing the authorization code. Your server uses this value to return `302 Found` to the browser, delivering the authorization response to the client. Handle the `action` of this second response exactly as described in [Action Handling](/get-started/concepts/action-handling). If the user cancels or authentication fails, call [/auth/authorization/fail](/api-reference/authorization-endpoint/fail-authorization-request) — with the same `ticket` — instead of [/auth/authorization/issue](/api-reference/authorization-endpoint/issue-authorization-response), and Authlete builds the appropriate error response for the client. ## The Ticket As shown above, a ticket is issued in the response of the first call and consumed by the second call to complete the processing — it is a single-use value. Its properties: * A ticket expires in 24 hours. Expired tickets are deleted from Authlete's database. * A ticket can be used only once. It is removed right after [/auth/authorization/issue](/api-reference/authorization-endpoint/issue-authorization-response) or [/auth/authorization/fail](/api-reference/authorization-endpoint/fail-authorization-request) successfully processes a request including it. * Using a ticket that has already been used or expired results in an error like this: ``` [A041202] There is no entity having the ticket specified in the /api/auth/authorization/issue request (ticket = {Ticket}). ``` Tickets are designed to be used only between your authorization server and the Authlete server. Do not expose them to user agents such as web browsers — for example, never use a ticket to manage browser sessions. ## The Same Model in Other APIs The userinfo endpoint is a good example of the same model. The [/auth/userinfo](/api-reference/userinfo-endpoint/process-userinfo-request) API validates the access token presented by the client and returns an `action`. When the action is `OK`, your server gathers the end-user's claim values and calls [/auth/userinfo/issue](/api-reference/userinfo-endpoint/issue-userinfo-response) to build the userinfo response — Authlete formats it as plain JSON or as a signed/encrypted JWT according to the client's configuration. The userinfo endpoint does not use a ticket; here the access token itself carries the context between the two calls. The token endpoint also has two-step variants: when your service supports the Resource Owner Password Credentials grant, the [/auth/token](/api-reference/token-endpoint/process-token-request) API returns `action=PASSWORD`, and your server validates the end-user's credentials before calling [/auth/token/issue](/api-reference/token-endpoint/issue-token-response) or [/auth/token/fail](/api-reference/token-endpoint/fail-token-request). The same pattern applies to `TOKEN_EXCHANGE` ([RFC 8693](https://www.rfc-editor.org/rfc/rfc8693)) and `JWT_BEARER` ([RFC 7523](https://www.rfc-editor.org/rfc/rfc7523)), where your server validates the subject token or assertion. Once you understand the `action`-based model and the two-step pattern, every Core API follows naturally from its API reference. # AI Agent Integration (llms.txt / MCP) Source: https://developers.authlete.com/get-started/developer-resources/ai-agent-integration Explains how to load the Authlete documentation into AI coding tools through llms.txt, Markdown pages, and the MCP server. No authentication or sign-up is required. This documentation site is also published in formats that AI coding tools can read directly: [llms.txt](https://llmstxt.org/), a Markdown version of each page, and an [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server. With these formats, your tools can search and read API specifications, settings, and implementation guides. No authentication or prior sign-up is required. You can use these formats to check specifications while implementing, and also to investigate errors or confirm behavior after release. ## Loading the documentation by URL To give your AI agent the documentation, pass it one of the following URLs. No tool-side setup is needed. | Purpose | URL | | - | - | | List of all pages | `https://developers.authlete.com/llms.txt` | | Full text of all pages in one file | `https://developers.authlete.com/llms-full.txt` | | A single page as Markdown (example: Action Handling) | `https://developers.authlete.com/get-started/concepts/action-handling.md` | * `llms.txt` links to separate indexes for English and Japanese, and for 3.x and 2.x. * `llms-full.txt` contains the English 3.x pages only. Its size is about 2.6 MB. For Japanese or 2.x pages, follow the indexes in `llms.txt` and read the pages you need. * Appending `.md` to a page URL returns the Markdown version of the page. Japanese pages have `/ja/` at the start of the path, for example `https://developers.authlete.com/ja/get-started/concepts/action-handling.md`. ## Page menu actions The menu next to **Copy page** at the top of each page provides the following actions. | Action | Description | | - | - | | **Copy page** | Copies the page as Markdown | | **View as Markdown** | Opens the page as Markdown | | **Open in ChatGPT** / **Open in Claude** | Starts a conversation about the page | | **Copy MCP Server** | Copies the MCP server URL | | **Connect to Cursor** | Installs the MCP server in Cursor | ## Connecting to the MCP server If your tool supports MCP, register the MCP server endpoint `https://developers.authlete.com/mcp`. The tool can then search and read the documentation directly. ```text theme={null} https://developers.authlete.com/mcp ``` The MCP server also contains the Authlete 2.x documentation. If `version` is not specified, search results can include 2.x pages. Tell your AI agent which Authlete version you use, and have it specify `version` in `search_authlete_documentation` (`3.x` for Authlete 3.0). The transport is HTTP. No authentication is required. The configuration format depends on the tool; see your tool's documentation for details. The following examples register the server as `authlete-docs`. ```bash Claude Code theme={null} claude mcp add --transport http authlete-docs https://developers.authlete.com/mcp ``` ```json Cursor (.cursor/mcp.json) theme={null} { "mcpServers": { "authlete-docs": { "url": "https://developers.authlete.com/mcp" } } } ``` ```json VS Code (.vscode/mcp.json) theme={null} { "servers": { "authlete-docs": { "type": "http", "url": "https://developers.authlete.com/mcp" } } } ``` ```toml Codex (~/.codex/config.toml) theme={null} [mcp_servers.authlete-docs] url = "https://developers.authlete.com/mcp" ``` If you commit a project-level configuration file, such as `.cursor/mcp.json` or `.vscode/mcp.json`, to your repository, everyone on the project gets the same setup. ### MCP server tools The MCP server provides the following three tools. | Tool | Description | | - | - | | `search_authlete_documentation` | Searches the documentation. `language` (`en` by default, `ja` for Japanese) and `version` (`3.x` or `2.x`) narrow the results. | | `query_docs_filesystem_authlete_documentation` | Reads pages and the OpenAPI specification with read-only commands such as `rg`, `cat`, and `tree`. | | `submit_feedback` | Reports a documentation page that is incorrect, outdated, or incomplete to the Authlete documentation team. | ## Using AI agent answers * Authlete 3.0 is the current version. Documentation for Authlete 2.x (pages under `/v2/`) is for users of the legacy version. * The documentation is updated regularly. Do not rely on an AI agent's answer as is; confirm it on the relevant page. * If you cannot find what you need in the documentation, do not guess. [Contact us](https://www.authlete.com/contact/). # GitHub Source: https://developers.authlete.com/get-started/developer-resources/github TODO: Add content. # Java SDK Source: https://developers.authlete.com/get-started/developer-resources/java-sdk # Reference Implementations Source: https://developers.authlete.com/get-started/developer-resources/leveraging-reference-implementations Develop your own authorization servers efficiently with Authlete's publicly available and open-sourced reference implementations downloadable from GitHub. These are also useful for direct interaction with Authlete APIs. reference-implementations_en *Reference implementations in Authlete 's architecture* Almost all of Authlete's features are [exposed as APIs](https://docs.authlete.com/) .  "Reference implementations" utilizing the APIs are also publicly available and open-sourced. You may be able to efficiently develop your own authorization servers with them. These implementations are downloadable from GitHub. [Authlete, Inc. · GitHub](https://github.com/authlete) The reference implementations are useful even if you would like to directly interact with Authlete APIs. Codes and documents in the implementations would tell you what you should do pre and post processing for the APIs. For example, there are JavaDoc documents of classes representing responses of Authlete APIs ("\*Response" e.g. [AuthorizationResponse](http://authlete.github.io/authlete-java-common/com/authlete/common/dto/AuthorizationResponse.html) under [com.authlete.common.dto](https://github.com/authlete/authlete-java-common/tree/master/src/main/java/com/authlete/common/dto) package in [authlete-java-common](https://github.com/authlete/authlete-java-common) library).  They explain details on expected post processing in authorization server on receiving a response from Authlete APIs. Popular reference implementations are as follows. * Java * [authlete-java-common](https://github.com/authlete/authlete-java-common): Authlete Common Library for Java * [authlete-java-jaxrs](https://github.com/authlete/authlete-java-jaxrs): Authlete Library for JAX-RS (Java) * [java-oauth-server](https://github.com/authlete/java-oauth-server): Authorization Server Implementation in Java * C# * [authlete-csharp](https://github.com/authlete/authlete-csharp): C# library for Authlete Web APIs * [OAuth 2.0 and OpenID Connect implementation in C# (Authlete)](https://medium.com/@darutk/oauth-2-0-and-openid-connect-implementation-in-c-authlete-8a8f9efc9361) * PHP * [authlete-php](https://github.com/authlete/authlete-php): PHP library for Authlete Web APIs * [authlete-php-laravel](https://github.com/authlete/authlete-php-laravel): A Laravel library for OAuth 2.0 and OpenID Connect * [OAuth 2.0 and OpenID Connect Implementation in Laravel (Authlete)](https://medium.com/@darutk/oauth-2-0-and-openid-connect-implementation-in-laravel-authlete-4d32802ab335) * Python * [authlete-python](https://github.com/authlete/authlete-python): Authlete Library for Python # OpenAPI Source: https://developers.authlete.com/get-started/developer-resources/openapi # Ruby SDK Source: https://developers.authlete.com/get-started/developer-resources/ruby-sdk TODO: Add content. # TypeScript SDK Source: https://developers.authlete.com/get-started/developer-resources/typescript-sdk # Architecture Source: https://developers.authlete.com/get-started/introduction-to-authlete/architecture Authlete acts as the backend engine for OAuth 2.0 and OpenID Connect processing. It is not directly accessed by the end user or the client application. Instead, it is called by the service provider’s own systems, mainly the Authorization Server and API Server. ## Overall Architecture ```mermaid placement="top-right" theme={null} %%{init: { 'themeVariables': { 'fontSize': '24px', 'nodeTextMargin': 40 }, 'flowchart': { 'nodeSpacing': 40, 'rankSpacing': 40, 'padding': 5 } }}%% graph LR subgraph user[End User] direction TB ro[Resource
Owner] ua[User
Agent] ro --> ua end subgraph app[Client Application] direction TB client[OAuth Client /
OIDC RP] end subgraph provider[Service Provider] direction TB subgraph auth[Authentication Server] direction TB user_authn[User
Authentication] user_db[User
Database] user_authn --> user_db end subgraph as[Authorization Server] direction TB oauth_ep[OAuth/OIDC
Endpoints] authz_decision[Authorization
Decision] end subgraph api[API Server] direction TB rs[Resource
Server] end end subgraph authlete[Authlete] direction TB protocol_processing[Protocol
Processing] token_management[Token
Management] client_management[Client
Management] service_management[Service
Management] end %% User interaction with client ua --> client %% User authentication / consent ua -- Login / Consent --> user_authn %% Authorization request via User Agent ua -- Authorization Request --> oauth_ep %% Direct client-to-AS communication client -- Token
Request --> oauth_ep %% Authorization server internal processing oauth_ep --> authz_decision oauth_ep --> authlete %% API access client -- API
Request --> rs rs --> authlete ``` The diagram has four main areas: | Area | Role | | - | - | | End User | The actual user and their browser or user agent | | Client Application | The OAuth Client / OIDC Relying Party, e.g., a web or mobile application | | Service Provider | The system that manages the Authorization Server, Authentication Server, and API Server | | Authlete | Backend service for OAuth/OIDC protocol logic, token management, client management, and service management | *** ## What Authlete Is Responsible For Inside Authlete, the diagram shows four main responsibilities. ### Protocol Processing Authlete handles the OAuth 2.0 and OpenID Connect protocol logic. For example, it helps process authorization requests, token requests, introspection requests, revocation requests, and other OAuth/OIDC-related operations. ### Token Management Authlete manages tokens such as: * Authorization codes * Access tokens * Refresh tokens * ID tokens, in OpenID Connect scenarios The Authorization Server exposes the endpoint to the client, but Authlete can handle much of the token-related logic behind the scenes. ### Client Management Authlete manages OAuth/OIDC client information, such as: * Client IDs and credentials (e.g., client secrets, JWKs) * Redirect URIs * Allowed grant types * Allowed scopes ### Service Management Authlete also manages service-level settings, such as: * Issuer information * Supported OAuth/OIDC flows * Supported scopes * Signing algorithms * Service configuration ## What the Service Provider Still Owns Even when using Authlete, the Service Provider still runs several important components. ### Authorization Server The Service Provider owns the OAuth/OIDC endpoints, such as: * Authorization endpoint * Token endpoint * Revocation endpoint * Introspection endpoint (for Resource Servers) * UserInfo endpoint (for OpenID Connect Relying Parties) * Well-known configuration endpoint However, these endpoints call Authlete to perform the actual OAuth/OIDC processing. ### Authentication Server The Service Provider owns user authentication. That means the following remain outside Authlete: * Login screens * User authentication logic * User database Authlete does not directly authenticate the user. Instead, it works with the result of authentication performed by the Service Provider. ### API Server The API Server contains the Resource Server. When the Client Application sends an API request with an access token, the Resource Server may call Authlete to validate or introspect the token. # Typical Request Flow A typical flow from the diagram is: 1. The End User uses a User Agent, such as a browser. 2. The User Agent interacts with the Client Application. 3. The Client Application sends an authorization request to the Authorization Server via the User Agent. 4. **The Authorization Server calls Authlete to process the request.** 5. The user is redirected or guided to login and consent. 6. The Authentication Server verifies the user using the User Database. 7. The Authorization Server makes the authorization decision. 8. **The Authorization Server calls Authlete to create an authorization response that includes an authorization code.** 9. The Authorization Server sends the authorization response back to the Client Application via the User Agent. 10. The Client Application calls the Authorization Server to exchange the authorization code for an access token at the token endpoint. 11. **The Authorization Server calls Authlete to process the token request.** 12. The Authorization Server sends the token response back to the Client Application. 13. The Client Application uses the token to call the API Server. 14. **The Resource Server may call Authlete to validate the token.** 15. The API Server responds to the Client Application. ```mermaid placement="top-right" theme={null} sequenceDiagram box End User participant EndUser as End User participant UserAgent as User Agent end box Client Application participant ClientApp as Client
Application end box Service Provider participant AuthzServer as Authorization
Server participant UserAuthn as Authentication
Server participant APIServer as Resource
Server end box Authlete participant Authlete as Authlete end EndUser->>UserAgent: Use browser UserAgent->>ClientApp: Interact with app ClientApp-->>UserAgent: Authorization request UserAgent->>AuthzServer: Authorization request AuthzServer->>Authlete: Send authorization request content Authlete-->>AuthzServer: "ticket" and other data (e.g., client info, requested scopes, etc.) AuthzServer->>UserAuthn: Process user
authentication UserAuthn<<->>UserAgent: Verify user UserAuthn->>UserAuthn: Verify user credentials UserAuthn-->>AuthzServer: Authentication
result AuthzServer->>AuthzServer: Make authorization decision AuthzServer->>Authlete: Send "ticket" and other data (e.g., subject identifier, claims, etc.) Authlete-->>AuthzServer: Authorization response data AuthzServer-->>UserAgent: Send authorization response UserAgent->>ClientApp: Send authorization
response ClientApp->>AuthzServer: Token request AuthzServer->>Authlete: Send token request content Authlete-->>AuthzServer: Token response data AuthzServer-->>ClientApp: Send token response ClientApp->>APIServer: API request with token APIServer->>Authlete: Token introspection
(optional) Authlete-->>APIServer: Token introspection
result (optional) APIServer-->>ClientApp: API response ClientApp-->>UserAgent: Response ``` # Overview Source: https://developers.authlete.com/get-started/introduction-to-authlete/overview Authlete is a headless solution and provides a set of APIs specialized for OAuth 2.0 and OpenID Connect protocol processing and token lifecycle management. # What is Authlete? Authlete is a [BaaS (Backend as a Service)](https://en.wikipedia.org/wiki/Backend_as_a_service) for implementing [OAuth 2.0](https://tools.ietf.org/html/rfc6749) and [OpenID Connect](https://openid.net/). By using the [Web APIs](https://docs.authlete.com/) that Authlete provides, you can implement OAuth 2.0 and OpenID Connect functionality with less effort. # Why do you need Authlete? When you implement a Web API, you need to implement OAuth 2.0 (and OpenID Connect) on the service provider side. That implementation is not trivial and often requires significant resources and time. Managing personal data also demands great care. Using limited engineering resources to address these challenges while launching before competitors is difficult. Authlete helps you address these challenges. Authlete supports many finalized and draft API authorization-related specifications. Using Authlete makes it relatively easy to implement a Web API. # Authlete features Because Authlete provides APIs to build an authorization server rather than a prebuilt server, it offers the following benefits. Time to market

What distinguishes Authlete is that all functionality required to implement an OAuth 2.0 and OpenID Connect server is designed and implemented as Web APIs. Not only client application registration and authorization server metadata management, but also the logic behind authorization and token endpoints is provided via Web APIs.

As a result, you can use Authlete with any language or framework—Java, Ruby, PHP, C#, and more. Using OSS libraries, you can implement a server in days to weeks.

Authlete delivers OAuth/OIDC behavior through Web APIs. The authorization and token endpoints run in your environment. So you can design the consent UI and user flow to match your product and brand.

UI/UX
Multiple instances

With Authlete you can operate multiple OAuth/OIDC server instances.

The management console is built for managing multiple instances. You can add and manage instances with different settings from the console without writing extra code.

You can run separate OAuth/OIDC servers for different use cases—for example, one for mobile apps and one for server-to-server integration, or one for end users and one for admin users—without a large increase in development effort.

Architectural flexibility

Authlete focuses on authorization and works with any user authentication, identity, or API management solution. You can keep your existing authentication and identity infrastructure and add OAuth/OIDC with minimal development.

When you use Authlete, the only end-user information you need to pass to Authlete is a stable subject identifier per user. Authlete accepts that identifier and associates it with tokens and other protocol data.

You do not need to share end-user names, email addresses, or credentials with Authlete. This is a major difference from all-in-one authentication-and-authorization solutions.

When generating ID tokens, you can send the claims to embed to Authlete’s API to fulfill OpenID Connect behavior.

Authlete supports RFC 6749 and many other specifications. It is OpenID Connect certified and was the first production-ready solution to achieve Financial-grade API (FAPI) certification. The supported specifications are listed per Authlete version on the Spec Sheet.

Latest specs

Because OAuth/OIDC behavior is delivered via Web APIs, supporting new specifications places minimal burden on your code. For example, to support PKCE, while the client requests will now include the new PKCE-related parameters, no changes are required to your authorization server implementation.

# OpenID Certification Authlete is certified for several [OpenID Provider (OP) profiles](https://openid.net/certification/). The certified profiles — OpenID Provider, FAPI 1.0 Advanced, FAPI-CIBA and FAPI 2.0 — are listed under [Certification and Conformance](https://www.authlete.com/product#conformance), and the [Spec Sheet](https://www.authlete.com/legal/spec_sheet/) shows which Authlete version each one applies to. # Summary You can support OAuth 2.0 and OpenID Connect in your web service with Authlete. To try it out, continue with [Getting Started](/get-started/quickstarts/getting-started). # First API Call 🚀 Source: https://developers.authlete.com/get-started/quickstarts/getting-started Set up your Authlete account and make your first API call in just a few minutes. This page is for Authlete 3.0. For 2.x, see [Getting Started (2.x)](/v2/get-started/quickstarts/getting-started). ## 1. Create an Authlete Account To use Authlete, you need an account. Once registered, you can configure all features through the management console. [Visit the Authlete website](https://www.authlete.com) and click [Free Trial](https://console.authlete.com/register) in the upper-right corner. Authlete website homepage with Free Trial button prominently displayed in the upper-right corner Choose your preferred registration method. You can use **social login (Google or GitHub)** or sign up with your **email address**. Signup page showing registration options: social login with Google and GitHub buttons, and an email address signup field After verifying your social login or email address, complete the profile page by entering your **first name**, **last name**, and **organization name** (and **Password** if using email registration). Review Authlete’s Privacy Policy and Terms of Service, then click **Register** to agree and complete your signup. User profile form with input fields for first name, last name, and organization name, with checkboxes to review Privacy Policy and Terms of Service, and a blue Register button *** ## 2. Create a Service Immediately after signing up, you will be directed to the **Services** page. This page displays all services under your organization (which was created during the signup process). A **Service** represents the backend of your Authorization Server. It contains all the configurations required to operate a production-grade authorization server, including OAuth/OIDC settings, token management, and security policies. Click **Create Service** to add a new Authlete service to your organization. Services page showing a list of existing services under the organization with a blue Create Service button in the upper right 1. Select your preferred **API Cluster** location (e.g., `US`). All service data will be stored in this selected cluster. Choose the cluster based on your data residency and environment isolation requirements. 2. Enter a **Service Name** (e.g., `Sample Service`). 3. Click **Create** to complete the setup. Create service form with dropdown menu to select API cluster location such as US, input field for service name, and a blue Create button Now you have completed to create a new Service. *** ## 3. Create a Service Access Token You will need a **Service Access Token** to authenticate your Authlete API calls. Click **Service Settings** for your newly created service. Service overview page with Service Settings option displayed for the newly created service 1. Note down the **Service Identifier** value (e.g., `21653835348762`), which is required when making requests in many Authlete APIs. 2. Click **Create Token** to create a new Service Access Token. Service settings page displaying the Service Identifier value and a blue Create Token button to generate a new Service Access Token 1. Enter a **token Name** (e.g., `oauth-server-token`). 2. Specify the **Expiration Date**. 3. Select the appropriate **Permissions** (e.g., **Authorization Server** preset). 4. Click **Create Token**. Add a Service Access Token dialog showing Token Name field with oauth-server-token, Expiration Date field with date picker, Permission Presets section with Authorization Server option highlighted in orange, Custom Token Permissions checkboxes below, and a blue Create Token button at the bottom The new Service Access Token will appear in the list. 1. Click the **Copy** or **Show** icon to retrieve the token value, as it is required for most Authlete API requests. Please note that this value is only displayed once upon creation. 2. Click **Back to Service Overview** to return to the main Service page. Service Access Token list showing the newly created token with Copy and Show buttons next to it, and a Back to Service Overview link to return to the main service page *Now you are ready to test the Authlete API!* *** ## 4. Call the Authlete API Let’s make your first API request to Authlete’s [/service/configuration](/api-reference/service-management/get-service-configuration) API, which acts as the backend for the OIDC discovery endpoint, generating OpenID provider metadata so that the endpoint can return in response to requests from clients (OIDC relying parties). ```mermaid placement="top-right" theme={null} %%{init: { 'themeVariables': { 'fontSize': '20px', 'nodeTextMargin': 40 }, 'flowchart': { 'nodeSpacing': 40, 'rankSpacing': 40, 'padding': 5 } }}%% graph LR client[OIDC RP] subgraph as[OIDC IdP] direction TB disco[Discovery
Endpoint] end subgraph authlete[Authlete] direction TB config["/service/configuration
API"] end client -- Metadata
Request --> disco disco -- Service
Configuration
Request
--> config ``` Below are examples using **curl** and the **API Explorer**. Please replace the placeholder values with your actual environment details. | Item | Value | | :- | :- | | **API Cluster Hostname** | `https://us.authlete.com` | | **Service Access Token** | `UpUodxmvxO7Yd06O9QCxForhwM5Mz5PHZuVW3WFQgsc` | | **Service ID** | `21653835348762` | ### Using curl Run the following command in your terminal to send an HTTP GET request: ```bash For Linux/MacOS theme={null} curl -X GET "https://us.authlete.com/api/21653835348762/service/configuration" \ -H "Authorization: Bearer UpUodxmvxO7Yd06O9QCxForhwM5Mz5PHZuVW3WFQgsc" ``` ```powershell For Windows theme={null} curl.exe -X GET "https://us.authlete.com/api/21653835348762/service/configuration" ` -H "Authorization: Bearer UpUodxmvxO7Yd06O9QCxForhwM5Mz5PHZuVW3WFQgsc" | ConvertFrom-Json ``` If successful, the API will return OpenID Provider Metadata similar to this: ```json theme={null} { "issuer": "https://authlete.com", [...] "scopes_supported": [ "address", "email", "openid", "offline_access", "phone", "profile", "grant_management_query", "grant_management_revoke" ], "response_types_supported": [ "none", "code", "id_token", "code id_token" ], [...] } ``` ### Using API Explorer Open the [/service/configuration API reference page](/api-reference/service-management/get-service-configuration) and click the **Try it** button. API Explorer interface for the /service/configuration endpoint with Try it button ready to be clicked to test the API 1. Choose the **API Cluster Hostname**. 2. Enter the **Service Access Token**. 3. Enter the **Service ID**. 4. Click **Send**. API Explorer form with input fields for Service ID and Service Access Token, and a blue Send button to execute the API request The API response will be displayed in the Response section. API response displayed in the Response section of the API Explorer showing JSON data with service configuration details including issuer, supported scopes, and response types *** ## Next Steps Now that your Authlete account is set up and your service is configured, it's time to explore further: * [**OAuth 2.0 Basics - API Tutorials**](/get-started/quickstarts/oauth-2-0-basics): Learn how Authlete works under the hood by calling the APIs directly using curl and other tools. * [**Using Demo Authorization Server**](/get-started/quickstarts/using-demo-authorization-server): Deploy an open-source authorization server frontend that integrates with Authlete APIs to test live OAuth/OIDC flows. *** ## Extra: OAuth/OIDC Processing Let's explore Authlete's OAuth/OIDC protocol processing by testing a sample authorization request. ### Create a Client A **Client** represents an application that interacts with the Authorization Server to request tokens, or with the Resource Server to access protected resources. Clients are managed within the context of a specific Authlete Service. On the Service page, click the **Create Client** button at the top-right of the screen. Service page with Create Client button located in the upper-right corner of the screen ready to be clicked Enter a **Client Name** and click **Create**. Create client dialog form with input field for Client Name and a blue Create button to add the new client Once created, the client details will be displayed. Make a note of the **Client ID** and **Client Secret** if needed. In the **Redirect URIs** section, click **Add** to register your application's redirect URIs. Client details page showing Client ID and Client Secret values, with a Redirect URIs section and an Add button to register application redirect URIs For example, enter `https://client.example.org/cb/example.com` and click **Save Changes**. Redirect URI input form with example value https://client.example.org/cb/example.com and a blue Save Changes button to confirm the entry ### Call "Process Authorization Request" API Navigate to the [Try /auth/authorization API](/api-reference/authorization-endpoint/process-authorization-request?playground=open) tool. 1. Choose the **API Cluster Hostname**. 2. Enter the **Service Access Token**. 3. Enter the **Service ID**. 4. Enter the authorization request content below into the **parameters** field. Please note that you must replace the example `client_id` value (`2329821874`) with the one you created in the previous step. 5. Click **Send**. | Parameter | Value | | :- | - | | **parameters** | `redirect_uri=https://client.example.org/cb/example.com&client_id=2329821874&response_type=code` | API Explorer showing the /auth/authorization endpoint with parameters entered You will see the API response in the Response section. API Explorer showing the /auth/authorization endpoint with parameters entered and the JSON response displayed in the Response section showing authorization request results # OAuth 2.0 Basics Source: https://developers.authlete.com/get-started/quickstarts/oauth-2-0-basics A tutorial to understand how OAuth 2.0 authorization server leverages Authlete APIs. This page is for Authlete 3.0. For 2.x, see [this page](/v2/get-started/core-concepts/oauth-basics). # Preface This tutorial describes the basic usage of [Authlete APIs](/api-reference) to implement an OAuth 2.0 authorization server that supports the authorization code grant flow. It also shows how Resource Servers can use Authlete APIs to quickly validate the access tokens, providing secure and authorized access to APIs. **Prerequisites:** * Basic knowledge of OAuth 2.0. * Access to an Authlete account. [Sign up here if needed](https://console.authlete.com/register). # Components A typical OAuth 2.0 architecture involves multiple components, shown in the flowchart below. In this tutorial, we use the live, public cloud version of the [Authlete Management Console](https://console.authlete.com) and Authlete API Cluster running in the US region (`https://us.authlete.com`). The Authorization and Resource servers are simulated using `curl` commands etc., showing how an Authorization Server and Resource Server make API requests to Authlete for authorization, token issuance, and introspection. ```mermaid theme={null} flowchart LR subgraph EndUser [End User] userAgent["User Agent (N/A)"] resourceOwner["Resource Owner (N/A)"] end subgraph APIClient [API Client] client["Client (N/A)"] end subgraph APIServer [API Server] authServer["Authorization Server (curl)"] resourceServer["Resource Server (curl)"] authAdmin["Authlete Administrator"] end subgraph Authlete [Authlete] mgmtConsole["Authlete Management Console"] authAPI["Authlete API"] end resourceOwner --> userAgent userAgent -- "Access to Client" --> client userAgent -- "Authorization Request (User Authentication and Consent)" --> authServer client -- "Token Request" --> authServer client -- "API Request" --> resourceServer %% API Server interactions with Authlete authAdmin -- "Service/Client Management" --> mgmtConsole mgmtConsole -- "API Request" --> authAPI authServer -- "API Request" --> authAPI resourceServer -- "API Request" --> authAPI ``` The FQDNs for each component are listed below. While the Authorization Server and Client are simulated, their FQDNs are used to illustrate the OAuth flow. | Component | FQDN | | - | - | | Authlete API - US Cluster | `us.authlete.com` | | Authlete Management Console | `console.authlete.com` | | Authorization Server | `as.example.com` | | Client | `client.example.org` | | Resource Server | N/A | # Environment Setup Follow the [First API Call](/get-started/quickstarts/getting-started) to create a new Authlete Service and Client. Also, generate a Service Access Token, which is needed to call Authlete APIs. Enter your own values below, and the code/command samples on this page will update automatically. (In the SDK tabs, the service access token is read from the `SERVICE_ACCESS_TOKEN` environment variable rather than hard-coded.) # Walk-through The sequence diagram below shows the entire OAuth 2.0 flow as used in this tutorial. Refer back to it as you proceed through each step. ```mermaid theme={null} sequenceDiagram autonumber participant RO as Resource Owner participant UA as User Agent participant C as Client participant AS as Authorization Server participant RS as Resource Server participant API as Authlete API RO ->> UA: Start UA ->> C: Make a request C -->> UA: Authorization request UA ->> AS: Forward the request AS ->> API: POST /auth/authorization API -->> AS: OK to proceed
(including ticket) AS -->> UA: User authentication and consent page RO <<->> UA: Enter credentials UA ->> AS: Login and consent AS ->> API: POST /auth/authorization/issue
(with ticket) API -->> AS: Authorization response content
(including authorization code) AS -->> UA: Authorization response UA ->> C: Forward the response C ->> AS: Token request
(with authorization code) AS ->> API: POST /auth/token API -->> AS: Token response content
(including access token) AS -->> C: Token response C ->> RS: Access protected resource
(with access token) RS ->> API: POST /auth/introspection API -->> RS: Introspection response RS -->> C: Response to client C -->> UA: Content UA -->> RO: End ``` ## Authorization request from the client to the authorization server The client makes an authorization request to the authorization server via the user agent (Steps 3 and 4). In this tutorial, we’ll assume the following values are specified as parameters in the request. The values from the **Environment Setup** inputs are reflected below. The authorization server is expected to receive the following content (folded for readability) as an HTTP GET query string from the user agent. A typical authorization server should evaluate the following rules before proceeding with the authorization code grant flow. * Verify that a client associated with the client ID is registered with the authorization server. * Check that the redirect URI matches one of the URIs registered for the client. * Confirm that other parameter values, such as `response_type` and `scope`, are permitted for the client to specify in its request. Authlete's [`/auth/authorization`](/api-reference/authorization-endpoint/process-authorization-request) API performs the above request validation on behalf of the authorization server. Use sample command/code to make a request to the Authlete API (Step 5) by choosing one from the following language tab; the values will be updated as you edit the inputs above.
```bash cURL theme={null} curl -X POST "https://us.authlete.com/api/933860280/auth/authorization" \ -H "Authorization: Bearer DL7jo1z3iUIXyI5MnX" \ -H "Content-Type: application/json" \ -d '{ "parameters": "response_type=code&client_id=12818600553323&redirect_uri=https://client.example.org/cb/example.com"}' ``` ```powershell PowerShell theme={null} $headers = @{ Authorization = "Bearer DL7jo1z3iUIXyI5MnX" } $body = '{ "parameters": "response_type=code&client_id=12818600553323&redirect_uri=https://client.example.org/cb/example.com" }' Invoke-RestMethod -Method Post ` -Uri "https://us.authlete.com/api/933860280/auth/authorization" ` -Headers $headers -ContentType "application/json" -Body $body ``` ```java Java theme={null} // authlete-java-common — initialize the client once and reuse it across the steps below. AuthleteConfiguration config = new AuthleteSimpleConfiguration() .setApiVersion("V3") .setBaseUrl("https://us.authlete.com") .setServiceApiKey("933860280") .setServiceAccessToken(System.getenv("SERVICE_ACCESS_TOKEN")); AuthleteApi authleteApi = AuthleteApiFactory.create(config); AuthorizationRequest request = new AuthorizationRequest() .setParameters("response_type=code" + "&client_id=12818600553323" + "&redirect_uri=https://client.example.org/cb/example.com"); AuthorizationResponse response = authleteApi.authorization(request); System.out.println(response.getAction()); // INTERACTION System.out.println(response.getTicket()); ``` ```typescript TypeScript theme={null} import { Authlete } from "@authlete/typescript-sdk"; // Initialize the client once and reuse it across the steps below. const authlete = new Authlete({ serverURL: "https://us.authlete.com", bearer: process.env["SERVICE_ACCESS_TOKEN"] ?? "", }); const SERVICE_ID = "933860280"; const res = await authlete.authorization.processRequest({ serviceId: SERVICE_ID, authorizationRequest: { parameters: "response_type=code&client_id=12818600553323&redirect_uri=https://client.example.org/cb/example.com", }, }); console.log(res.action); // "INTERACTION" console.log(res.ticket); ``` ```ruby Ruby theme={null} require "authlete_ruby_sdk" # Initialize the client once and reuse it across the steps below. client = Authlete::Client.new( bearer: ENV.fetch("SERVICE_ACCESS_TOKEN"), server_url: "https://us.authlete.com" ) SERVICE_ID = "933860280" req = Authlete::Models::Components::AuthorizationRequest.new( parameters: "response_type=code&client_id=12818600553323&redirect_uri=https://client.example.org/cb/example.com" ) res = client.authorization.process_request(service_id: SERVICE_ID, authorization_request: req) puts res.authorization_response.action # "INTERACTION" puts res.authorization_response.ticket ``` ```go Go theme={null} package main import ( "context" "log" "os" authlete "github.com/authlete/authlete-go-sdk" "github.com/authlete/authlete-go-sdk/models/components" ) func main() { ctx := context.Background() // Initialize the client once and reuse it across the steps below. s := authlete.New( authlete.WithServerURL("https://us.authlete.com"), authlete.WithSecurity(os.Getenv("SERVICE_ACCESS_TOKEN")), ) const serviceID = "933860280" res, err := s.Authorization.ProcessRequest(ctx, serviceID, components.AuthorizationRequest{ Parameters: "response_type=code&client_id=12818600553323&redirect_uri=https://client.example.org/cb/example.com", }) if err != nil { log.Fatal(err) } log.Printf("action=%v", *res.AuthorizationResponse.Action) // INTERACTION log.Printf("ticket=%s", *res.AuthorizationResponse.Ticket) } ```
If the request is valid, Authlete returns a response like this (Step 6). ```json theme={null} { "action": "INTERACTION", "resultCode": "A004001", "resultMessage": "[A004001] Authlete has successfully issued a ticket to the service (API Key = 933860280) for the authorization request from the client (ID = 12818600553323). [response_type=code, openid=false]", "ticket": "cElOaH9j4mS6AiIGR9oLqHlDn9jpvcNjqSgyRqfcmAE", "client": {...}, "service": {...}, } ``` * `resultMessage` provides human-readable result of the request processing. (See also [Interpreting Authlete's result codes](/configuration-reference/error-handling-debugging/interpreting-authletes-result-codes)) * `action` indicates what the authorization server should do next. (See also [Action Handling](/get-started/concepts/action-handling)) * `ticket` is required for the authorization server to make a request to another API in the following step. (See also [Two-Step API Calls](/get-started/concepts/two-step-api-calls)) Authlete also provides service and client information in the response. The authorization server utilizes them to ask the resource owner if he or she authorizes access for the client to the service. ## User authentication and confirmation of granting access The actual interaction between the resource owner and the authorization server is out of scope for this tutorial. Typically, the authorization server would authenticate the user with credentials (e.g., ID and password), determine the user’s roles and privileges, and ask if they authorize access (Steps 7, 8 and 9). ## Issuing an authorization code Assume the authorization server reaches the following state after completing the previous process: * The authorization server has authenticated the resource owner and determined that the identifier to be shared with Authlete as the value of the `subject` parameter is `testuser01`. * The authorization server has obtained consent from the resource owner. The authorization server then makes a request to Authlete's [`/auth/authorization/issue`](/api-reference/authorization-endpoint/issue-authorization-response) to issue an authorization code. It includes the values of `subject` and `ticket` from the `/auth/authorization` API response as request parameters (Step 10). Enter your values below and the samples update automatically.
```bash cURL theme={null} curl -X POST "https://us.authlete.com/api/933860280/auth/authorization/issue" \ -H "Authorization: Bearer DL7jo1z3iUIXyI5MnX" \ -H "Content-Type: application/json" \ -d '{ "ticket": "5tqii9i_pUp1iteacZGUtdjikRnqGSrPwW7lqoH1Pcc","subject": "testuser01"}' ``` ```powershell PowerShell theme={null} $headers = @{ Authorization = "Bearer DL7jo1z3iUIXyI5MnX" } $body = '{ "ticket": "5tqii9i_pUp1iteacZGUtdjikRnqGSrPwW7lqoH1Pcc", "subject": "testuser01" }' Invoke-RestMethod -Method Post ` -Uri "https://us.authlete.com/api/933860280/auth/authorization/issue" ` -Headers $headers -ContentType "application/json" -Body $body ``` ```java Java theme={null} // Reuse the authleteApi client created in the authorization step. AuthorizationIssueRequest request = new AuthorizationIssueRequest() .setTicket("5tqii9i_pUp1iteacZGUtdjikRnqGSrPwW7lqoH1Pcc") .setSubject("testuser01"); AuthorizationIssueResponse response = authleteApi.authorizationIssue(request); System.out.println(response.getAction()); // LOCATION System.out.println(response.getAuthorizationCode()); System.out.println(response.getResponseContent()); ``` ```typescript TypeScript theme={null} // Reuse the `authlete` client and SERVICE_ID created in the authorization step. const res = await authlete.authorization.issue({ serviceId: SERVICE_ID, authorizationIssueRequest: { ticket: "5tqii9i_pUp1iteacZGUtdjikRnqGSrPwW7lqoH1Pcc", subject: "testuser01", }, }); console.log(res.action); // "LOCATION" console.log(res.authorizationCode); console.log(res.responseContent); ``` ```ruby Ruby theme={null} # Reuse the `client` and SERVICE_ID created in the authorization step. req = Authlete::Models::Components::AuthorizationIssueRequest.new( ticket: "5tqii9i_pUp1iteacZGUtdjikRnqGSrPwW7lqoH1Pcc", subject: "testuser01" ) res = client.authorization.issue_response(service_id: SERVICE_ID, authorization_issue_request: req) puts res.authorization_issue_response.action # "LOCATION" puts res.authorization_issue_response.authorization_code puts res.authorization_issue_response.response_content ``` ```go Go theme={null} // Reuse the `s` client and serviceID created in the authorization step. res, err := s.Authorization.Issue(ctx, serviceID, components.AuthorizationIssueRequest{ Ticket: "5tqii9i_pUp1iteacZGUtdjikRnqGSrPwW7lqoH1Pcc", Subject: "testuser01", }) if err != nil { log.Fatal(err) } log.Printf("action=%v", *res.AuthorizationIssueResponse.Action) // LOCATION log.Printf("authorizationCode=%s", *res.AuthorizationIssueResponse.AuthorizationCode) log.Printf("responseContent=%s", *res.AuthorizationIssueResponse.ResponseContent) ```
If the request is valid, Authlete generates the following response (Step 11). ```json theme={null} { "action": "LOCATION", "authorizationCode": "tJlGEKt8y0DLpjIA_jweywRtJs2fh83ZGNiwFRmIwYI", "idToken": null, "jwtAccessToken": null, "responseContent": "https://client.example.org/cb/example.com?code=tJlGEKt8y0DLpjIA_jweywRtJs2fh83ZGNiwFRmIwYI&iss=https%3A%2F%2Fauthlete.com", "resultCode": "A040001", "resultMessage": "[A040001] The authorization request was processed successfully.", "ticketInfo": { "context": null } } ``` * `resultMessage` provides a human-readable result of the request processing. (See also [Interpreting Authlete's result codes](/configuration-reference/error-handling-debugging/interpreting-authletes-result-codes)) * `action` indicates what the authorization server should do next. The value in this response is `LOCATION`, meaning the authorization server should make a redirection response back to the user agent. (See also [Action Handling](/get-started/concepts/action-handling)) * `responseContent` represents the content of the response from the authorization server. (See also [Action Handling](/get-started/concepts/action-handling)) The authorization server is expected to send the following response (folded for readability) to the user agent (Step 12). ```http theme={null} HTTP/1.1 302 Found Location: https://client.example.org/cb/example.com ?code=tJlGEKt8y0DLpjIA_jweywRtJs2fh83ZGNiwFRmIwYI ``` There are cases where the authorization server may decide not to issue tokens to the client due to the result of the previous authentication, user consent confirmation, or other missing context that prohibits token issuance. In these situations, the authorization server must inform the client that the authorization flow has been terminated with an appropriate protocol response. Authlete's [`/auth/authorization/fail`](/api-reference/authorization-endpoint/fail-authorization-request) API supports the termination process in terms of messages to be sent to the client, and transfer method for the response. To summarize, an authentication server usually makes a request to either `/auth/authorization/issue` or `/auth/authorization/fail` API depending on result of user authentication and consent. ## Token request Here, we assume that the user agent receives the redirection response from the authorization server. It then sends the following request (folded for readability) to the client (Step 13). Enter the **authorization code** (the `code` from the previous response) below and the samples update. The client extracts the value of the `code` parameter, crafts a token request using this value, and sends it to the authorization server as follows (folded for readability). In this tutorial, `https://as.example.com/token` is the token endpoint URI (Step 14). The authorization server evaluates the parameters in the request and then sends a token response back to the client. In this tutorial, we’ll use Authlete's [`/auth/token`](/api-reference/token-endpoint/process-token-request) API to evaluate the request and generate the response.
```bash cURL theme={null} curl -X POST "https://us.authlete.com/api/933860280/auth/token" \ -H "Authorization: Bearer DL7jo1z3iUIXyI5MnX" \ -H "Content-Type: application/json" \ -d '{ "clientId": "12818600553323","clientSecret": "AqZKLbUFfRurwZ0-zN1BwAXfo-odPwrZa6XoSOrm-AKtbaaOAq6uzWM3oVG4w","parameters": "grant_type=authorization_code&code=tJlGEKt8y0DLpjIA_jweywRtJs2fh83ZGNiwFRmIwYI&redirect_uri=https://client.example.org/cb/example.com" }' ``` ```powershell PowerShell theme={null} $headers = @{ Authorization = "Bearer DL7jo1z3iUIXyI5MnX" } $body = '{ "clientId": "12818600553323", "clientSecret": "AqZKLbUFfRurwZ0-zN1BwAXfo-odPwrZa6XoSOrm-AKtbaaOAq6uzWM3oVG4w", "parameters": "grant_type=authorization_code&code=tJlGEKt8y0DLpjIA_jweywRtJs2fh83ZGNiwFRmIwYI&redirect_uri=https://client.example.org/cb/example.com" }' Invoke-RestMethod -Method Post ` -Uri "https://us.authlete.com/api/933860280/auth/token" ` -Headers $headers -ContentType "application/json" -Body $body ``` ```java Java theme={null} // Reuse the authleteApi client created in the authorization step. TokenRequest request = new TokenRequest() .setClientId("12818600553323") .setClientSecret("AqZKLbUFfRurwZ0-zN1BwAXfo-odPwrZa6XoSOrm-AKtbaaOAq6uzWM3oVG4w") .setParameters("grant_type=authorization_code" + "&code=tJlGEKt8y0DLpjIA_jweywRtJs2fh83ZGNiwFRmIwYI" + "&redirect_uri=https://client.example.org/cb/example.com"); TokenResponse response = authleteApi.token(request); System.out.println(response.getAction()); // OK System.out.println(response.getAccessToken()); System.out.println(response.getResponseContent()); ``` ```typescript TypeScript theme={null} // Reuse the `authlete` client and SERVICE_ID created in the authorization step. const res = await authlete.token.process({ serviceId: SERVICE_ID, tokenRequest: { clientId: "12818600553323", clientSecret: "AqZKLbUFfRurwZ0-zN1BwAXfo-odPwrZa6XoSOrm-AKtbaaOAq6uzWM3oVG4w", parameters: "grant_type=authorization_code&code=tJlGEKt8y0DLpjIA_jweywRtJs2fh83ZGNiwFRmIwYI&redirect_uri=https://client.example.org/cb/example.com", }, }); console.log(res.action); // "OK" console.log(res.accessToken); console.log(res.responseContent); ``` ```ruby Ruby theme={null} # Reuse the `client` and SERVICE_ID created in the authorization step. req = Authlete::Models::Components::TokenRequest.new( client_id: "12818600553323", client_secret: "AqZKLbUFfRurwZ0-zN1BwAXfo-odPwrZa6XoSOrm-AKtbaaOAq6uzWM3oVG4w", parameters: "grant_type=authorization_code&code=tJlGEKt8y0DLpjIA_jweywRtJs2fh83ZGNiwFRmIwYI&redirect_uri=https://client.example.org/cb/example.com" ) res = client.tokens.process_request(service_id: SERVICE_ID, token_request: req) puts res.token_response.action # "OK" puts res.token_response.access_token puts res.token_response.response_content ``` ```go Go theme={null} // Reuse the `s` client and serviceID created in the authorization step. res, err := s.Token.Process(ctx, serviceID, components.TokenRequest{ ClientID: types.String("12818600553323"), // types: github.com/authlete/authlete-go-sdk/types ClientSecret: types.String("AqZKLbUFfRurwZ0-zN1BwAXfo-odPwrZa6XoSOrm-AKtbaaOAq6uzWM3oVG4w"), Parameters: "grant_type=authorization_code&code=tJlGEKt8y0DLpjIA_jweywRtJs2fh83ZGNiwFRmIwYI&redirect_uri=https://client.example.org/cb/example.com", }) if err != nil { log.Fatal(err) } log.Printf("action=%v", *res.TokenResponse.Action) // OK log.Printf("accessToken=%s", *res.TokenResponse.AccessToken) log.Printf("responseContent=%s", *res.TokenResponse.ResponseContent) ```
If the request is valid, Authlete responds as follows (Step 16). ```json theme={null} { "accessToken": "gV5ByjqCVjyinFugV9Wlc0oAxkEP0osifSajXSfJV9g", "accessTokenDuration": 86400, "accessTokenExpiresAt": 1730203012061, "action": "OK", "clientAuthMethod": "CLIENT_SECRET_BASIC", "clientId": 12818600553323, "grantType": "AUTHORIZATION_CODE", "refreshToken": "1mQRm2XRwaBNYRIjxjO0ls9hb4eDKo9I3ChU0yy8lHo", "refreshTokenDuration": 864000, "refreshTokenExpiresAt": 1730980612061, "responseContent": "{\"access_token\":\"gV5ByjqCVjyinFugV9Wlc0oAxkEP0osifSajXSfJV9g\",\"token_type\":\"Bearer\",\"expires_in\":86400,\"scope\":null,\"refresh_token\":\"1mQRm2XRwaBNYRIjxjO0ls9hb4eDKo9I3ChU0yy8lHo\"}", "resultCode": "A050001", "resultMessage": "[A050001] The token request (grant_type=authorization_code) was processed successfully.", "subject": "testuser01", } ``` * `resultMessage` provides a human-readable result of the request processing. (See also [Interpreting Authlete's result codes](/configuration-reference/error-handling-debugging/interpreting-authletes-result-codes)) * `action` indicates what the authorization server should do next. The value in this response is `OK`, meaning the authorization server should send a token response back to the client. (See also [Action Handling](/get-started/concepts/action-handling)) * `responseContent` contains the content of the response from the authorization server. (See also [Action Handling](/get-started/concepts/action-handling)) The authorization server is expected to send the following response to the client (Step 17). ```http theme={null} HTTP/1.1 200 OK Content-Type: application/json { "access_token":"gV5ByjqCVjyinFugV9Wlc0oAxkEP0osifSajXSfJV9g", "refresh_token":"1mQRm2XRwaBNYRIjxjO0ls9hb4eDKo9I3ChU0yy8lHo", "scope":null, "token_type":"Bearer", "expires_in":86400 } ``` The authorization server has now successfully created the tokens and provided them to the client. By leveraging Authlete APIs, the authorization server avoids the need to implement complex logic to evaluate parameters in authorization and token requests and can respond correctly using the appropriate methods. ## API request (access token introspection) In most cases, the client sends a request with the access token to the resource server providing the APIs (Step 18). The resource server is responsible for evaluating the token's validity, retrieving information about the user and client associated with the token, and determining how to respond to the API request. Authlete provides the [`/auth/introspection`](/api-reference/introspection-endpoint/process-introspection-request) API for this purpose. It verifies the token's validity and provides the necessary information. Enter the access token received by the resource server below, then use the following command to introspect it using the Authlete API.
```bash cURL theme={null} curl -X POST "https://us.authlete.com/api/933860280/auth/introspection" \ -H "Authorization: Bearer DL7jo1z3iUIXyI5MnX" \ -H "Content-Type: application/json" \ -d '{ "token": "gV5ByjqCVjyinFugV9Wlc0oAxkEP0osifSajXSfJV9g" }' ``` ```powershell PowerShell theme={null} $headers = @{ Authorization = "Bearer DL7jo1z3iUIXyI5MnX" } $body = '{ "token": "gV5ByjqCVjyinFugV9Wlc0oAxkEP0osifSajXSfJV9g" }' Invoke-RestMethod -Method Post ` -Uri "https://us.authlete.com/api/933860280/auth/introspection" ` -Headers $headers -ContentType "application/json" -Body $body ``` ```java Java theme={null} // Reuse the authleteApi client created in the authorization step. IntrospectionRequest request = new IntrospectionRequest() .setToken("gV5ByjqCVjyinFugV9Wlc0oAxkEP0osifSajXSfJV9g"); IntrospectionResponse response = authleteApi.introspection(request); System.out.println(response.getAction()); // OK System.out.println(response.isUsable()); // true System.out.println(response.getSubject()); // testuser01 System.out.println(response.getClientId()); // 12818600553323 (long) ``` ```typescript TypeScript theme={null} // Reuse the `authlete` client and SERVICE_ID created in the authorization step. const res = await authlete.introspection.process({ serviceId: SERVICE_ID, introspectionRequest: { token: "gV5ByjqCVjyinFugV9Wlc0oAxkEP0osifSajXSfJV9g", }, }); console.log(res.action); // "OK" console.log(res.subject); // "testuser01" console.log(res.clientId); // 12818600553323 (number) ``` ```ruby Ruby theme={null} # Reuse the `client` and SERVICE_ID created in the authorization step. req = Authlete::Models::Components::IntrospectionRequest.new( token: "gV5ByjqCVjyinFugV9Wlc0oAxkEP0osifSajXSfJV9g" ) res = client.introspection.process_request(service_id: SERVICE_ID, introspection_request: req) puts res.introspection_response.action # "OK" puts res.introspection_response.subject # "testuser01" puts res.introspection_response.client_id # 12818600553323 (Integer) ``` ```go Go theme={null} // Reuse the `s` client and serviceID created in the authorization step. res, err := s.Introspection.Process(ctx, serviceID, components.IntrospectionRequest{ Token: "gV5ByjqCVjyinFugV9Wlc0oAxkEP0osifSajXSfJV9g", }) if err != nil { log.Fatal(err) } log.Printf("action=%v", *res.IntrospectionResponse.Action) // OK log.Printf("subject=%s", *res.IntrospectionResponse.Subject) // testuser01 log.Printf("clientId=%d", *res.IntrospectionResponse.ClientID) // 12818600553323 (int64) ```
If the request is valid, Authlete returns the following response (Step 20). ```json theme={null} { "action": "OK", "authTime": 0, "clientId": 12818600553323, "expiresAt": 1730203012000, "grantType": "AUTHORIZATION_CODE", "issuableCredentials": null, "properties": null, "refreshable": true, "resources": null, "responseContent": "Bearer error=\"invalid_request\"", "resultCode": "A056001", "resultMessage": "[A056001] The access token is valid.", "scopeDetails": null, "scopes": null, "serviceAttributes": null, "subject": "testuser01", "sufficient": false, "usable": true } ``` The resource server can retrieve various information, such as the token’s expiration time (`expiresAt`), the identifier of the user who approved access (`subject`), the grant type used to obtain the token, and the client identifier (`clientId`). It then determines how to respond to the API request (Step 21). # Recap In this tutorial, we covered how to use Authlete APIs to implement the authorization code grant flow in an authorization server. # Next Steps Let’s dig deeper into Authlete by exploring the following features. * [Authlete API Tutorial - OIDC Basics](/get-started/quickstarts/oidc-basics) * [PKCE (RFC 7636)](/protocols-and-flows/protocol-extensions/proof-key-for-code-exchange-pkce) * [Authorization Server Reference Implementations](https://github.com/authlete/java-oauth-server) # OIDC Basics Source: https://developers.authlete.com/get-started/quickstarts/oidc-basics A tutorial to understand how OpenID Connect identity provider leverages Authlete APIs. This page is for Authlete 3.0. For 2.x, see [this page](/v2/get-started/core-concepts/oidc-basics). # Introduction This document is a tutorial to describe basic usage of [Authlete APIs](/api-reference) in order to implement OpenID Connect (OIDC) identity provider (IdP) server that supports the [authorization code flow](https://youtu.be/x2qtJZ3Wivc?feature=shared). In completing the tutorial, you will * Make requests simulating the requests which come from the authorization server to Authlete * Set the issuer identifier in the Authlete Management Console, include additional claims in the authorization request to the Authlete authorize endpoint, and confirm that both the issuer and additional claims are included in the ID Token by decoding it.