Authentication

Your Console comes with a powerful, comprehensive RESTful API that you can access within your app. Generate gameplay URLs, retrieve scores, and more.

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.

Generate JWT

get

Returns a JSON Web Token (JWT) you can use to authenticate API calls to 2bttns.

You can get the app_id and secret from your 2bttns admin console, under Settings/Apps.

Authorizations
Query parameters
app_idstringRequired
secretstringRequired
expires_instringOptional
Responses
200
Successful response
application/json
Responsestring
get
GET /api/authentication/token?app_id=text&secret=text HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
text

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

Check Auth Type

get

Returns a message that tells you what type of authentication you used to call this endpoint, if you are authenticated.

Authorizations
Responses
200
Successful response
application/json
Responsestring
get
GET /api/authentication/checkAuthType HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
text

OpenAPI and your Console

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

Try out the 2bttns API in your Console by navigating to API and using your Bearer Token.

The 2bttns API within your console is an 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.

Last updated

Was this helpful?