# Authentication

## Generate a JWT Bearer Token

To authenticate requests to the 2bttns API, you'll need to generate a JWT Bearer token to use in your request header using the `api/authentication/token` endpoint. To do this, you'll use the `app_id` and `secret` in you Console under **Settings**/**Apps**.

{% openapi src="<https://content.gitbook.com/content/n2L7ltGlCAKlpbJZ3edj/blobs/489xqKU5WXWpX6Dz2H47/openapi.json>" path="/authentication/token" method="get" %}
[openapi.json](https://content.gitbook.com/content/n2L7ltGlCAKlpbJZ3edj/blobs/489xqKU5WXWpX6Dz2H47/openapi.json)
{% endopenapi %}

To test your token, pass it as the header using the `api/authentication/checkAuthType` endpoint:

{% openapi src="<https://content.gitbook.com/content/n2L7ltGlCAKlpbJZ3edj/blobs/489xqKU5WXWpX6Dz2H47/openapi.json>" path="/authentication/checkAuthType" method="get" %}
[openapi.json](https://content.gitbook.com/content/n2L7ltGlCAKlpbJZ3edj/blobs/489xqKU5WXWpX6Dz2H47/openapi.json)
{% endopenapi %}

{% hint style="success" %}
To successfully connect your app to the Console, pass the `Bearer Token` in your API requests.
{% endhint %}

## OpenAPI and your Console&#x20;

You can try out the API within your Console by using your JWT token. Open your **Console** and navigate to **API** and click **Authorize.**

<figure><img src="https://3323071399-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fn2L7ltGlCAKlpbJZ3edj%2Fuploads%2FyU8bG68zN04L6sBFgnZl%2FScreenshot%202024-02-29%20at%205.29.03%E2%80%AFPM.png?alt=media&#x26;token=09b7a391-8d1f-432e-9a26-ef3b68dcc3d6" alt="" width="563"><figcaption><p>Try out the 2bttns API in your Console by navigating to API and using your Bearer Token.</p></figcaption></figure>

The 2bttns API within your console is an [OpenAPI](https://www.openapis.org/what-is-openapi) compliant REST API built using tRPC with Next.js. For a comprehensive overview of the available endpoints, open your Console and navigate to <http://localhost:3262/api-documentation>.

###
