# OAuth 2.0 Client Credentials Grant

## Overview

[OAuth 2.0 Client Credentials Grant](https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/) is an industry standard authorization flow. In this Authorization type the client application acquire access tokens without involving specific users. Instead of authenticating on behalf of a user, the client itself present its own credentials to the authorization server and receives an access token. This allows it to access protected resource on the server's behalf.

<div align="left"><figure><img src="/files/oEcdSeWIqwblylmkSh5r" alt="" width="537"><figcaption></figcaption></figure></div>

## Fields

The **OAuthClientCredentials** authentication type includes the following fields:

<table><thead><tr><th width="207.20001220703125">Field</th><th>Description</th></tr></thead><tbody><tr><td>Client Id </td><td>A unique identifier assigned to the client application by the authorization server.</td></tr><tr><td>Client Secret </td><td>A confidential string used by the client to authenticate itself to the authorization server.</td></tr><tr><td>Access Token URL </td><td>The URL where the client exchanges the authorization code for an access token.</td></tr><tr><td>Scope</td><td>This determines the scope or permissions being requested in the Authentication request. This list is space separated.</td></tr><tr><td>Access Token Extraction Key</td><td>This defines which key will contain the <code>access_token</code> in the returned JSON object. Defaults to <code>access_token</code>.</td></tr><tr><td>Expires In<br>Extraction Key</td><td>This defines which key will contain the  <code>expires_in</code> value for the access token in the returned JSON object. Defaults to <code>expires_in</code>.</td></tr><tr><td>Http Operation </td><td>What HTTP Operation is used for the authorization request. Can be <code>POST</code> or <code>GET</code>.</td></tr><tr><td>Headers</td><td>The custom headers in JSON format:<code>{"apiKey": "api_key_value"}</code></td></tr><tr><td>Use Raw Token</td><td>Enabling this removes the <code>Bearer</code> prefix from the Authorization header.</td></tr><tr><td>Grant Type</td><td>Grant types used in OAuth 2.0. The 'client_credentials' can be replaced according to the authorization flow of the external system.</td></tr><tr><td>Use JWT Token</td><td>This checkbox needs to be enabled only when we are going to use the JWT flow.</td></tr><tr><td>JWT Client Assertion Type</td><td>JWT Client Assertion Type is a method for authenticating OAuth 2.0 clients using JSON Web Tokens.</td></tr><tr><td>JWT Private Key</td><td>JWT Private Key is a cryptographic key used to sign JSON Web Tokens for authentication and authorization purposes.</td></tr><tr><td>JWT Headers</td><td>User is able to add JWT Header fields in JSON format</td></tr><tr><td>JWT Payload</td><td>User is able to add JWT Payload/Claims fields in JSON format</td></tr><tr><td>Server SSL Certificate</td><td>Provide a Server SSL Certificate to Trust</td></tr><tr><td>Trust any SSL Server Certificate</td><td>Trust any server if the integration is unable to verify the identity of the server it is requesting from</td></tr><tr><td>Client Certificate in PEM Format</td><td>Used for verifying the client in mTLS, this is the private key for the client.</td></tr><tr><td>Client Private Key in PEM Format</td><td>Used for verifying the client in mTLS, the certificate to use for the client</td></tr><tr><td>Client Private Key Passphrase</td><td>Used for verifying the client in mTLS, this is an optional passphrase</td></tr></tbody></table>

{% hint style="info" %}
Not all of the mentioned fields in the provided authorization flow are required. The necessary combination of fields may vary based on the specific requirements of the external system.
{% endhint %}

<div align="left"><figure><img src="/files/jhc64ILjAWO5McNqgkxQ" alt="" width="447"><figcaption></figcaption></figure></div>

### **OAuth Client Credentials Support Additional Key/Value Pairs**

The OAuth configuration accepts a JSON map, where you can give arbitrary values that need to be passed as body parameters, for example: `x-www-form-urlencoded`.

The Aisera Gen AI platform already passes body parameters for `client_id`, `client_secret`, `grant_type` and optionally for `scope`. You can also add arbitrary key-value pairs.

{% hint style="info" %}
If you put the pair `client_id` and `test` as Body Parameters, the `test` value will overwrite the configuration of the `client_id` field. The same applies to the client secret and scope.
{% endhint %}

### JWT Authentication

The Aisera Platform supports the use of JWT credentials in the same flow and configuration. When enabling the **Use JWT Token** checkbox, the Aisera Platform will use the JWT related fields for authentication with the third-party application..

### mTLS Support

This form of authentication supports the use of  Mutual Transport Layer Security (mTLS). mTLS is an authentication protocol in which the client and the server verify the identity of each other. This is an extension of Transport Layer Security (TLS) in which the identify of a server is verified through a Certified Authority.&#x20;

## Configuring the external platform

When configuring the external system for OAuth 2.0 integration with the Aisera platform, the following redirect URLs may need to be whitelisted.

### Service Account Authorization

For service account authorization for use with the data sources and workflows whitelist:

`https://<cluster_id>.login.aisera.<top_level_domain>/?id=aisera.oauth.oauthCommand`

Contact your Aisera support team for the Cluster Id.

### User Authorization

For user authorization for use with workflows whitelist:

`https://<vanity_url>.chatbot.aisera.<top_level_domain>/oauth2/authorize`&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aisera.com/aisera-platform/adding-data-to-your-tenant/integrations-and-data-sources/supported-auth-types-for-custom-integrations/oauth-2.0-client-credentials-grant.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
